Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using client.get on a closed redis server causes uncatchable exception #67

Open
rickybassom opened this issue Jan 29, 2017 · 2 comments

Comments

@rickybassom
Copy link

When the Redis Server is closed, after initially connecting, using client.get() causes an uncatchable exception (shown in output):

Example code

import 'dart:async';
import 'package:redis_client/redis_client.dart';

main(List<String> args) {
  conn();
}

conn() async{
  var client = await RedisClient.connect("localhost:6379").catchError((Exception except){
    throw new Exception("Redis localhost:6379 connection failed - " + except.toString());
  });

  const oneSec = const Duration(seconds: 1);
  new Timer.periodic(oneSec, (Timer t) async {
    try{
      String status = await client.get("status");
      print(status);
    }catch(e){
      print(e.toString());
    }

  });
}

Output

Unhandled exception:
SocketException: OS Error: Broken pipe, errno = 32, address = localhost, port = 35980
#0      _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1138)
#1      _microtaskLoop (dart:async/schedule_microtask.dart:41)
#2      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#3      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

It could be related to this issue: dart-lang/sdk#17468

@tejainece
Copy link

I am getting the same error in sqljocky5 package when a telegram is sent after the mysql server has shutdown. There is no way to catch this error.

I think it is due to a problem in the Dart SDK.

@tejainece
Copy link

I have created a Dart SDK issue here: dart-lang/sdk#35995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants