Skip to content

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

@rickybassom

Description

@rickybassom

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions