EINTR: The operation was interrupted
Opened this issue · 10 comments
On Android, I use
socket.send(result);
socket.recv();
An error will be reported
E/flutter (18544): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ZeroMQException(4): EINTR: The operation was interrupted
E/flutter (18544): #0 _checkErrorCode (package:dartzmq/src/exception.dart:56:5)
E/flutter (18544): #1 _checkReturnCode (package:dartzmq/src/exception.dart:49:5)
E/flutter (18544): #2 ZSyncSocket.recv (package:dartzmq/src/socket.dart:406:9)
E/flutter (18544): #3 _FirmwareBodyWidgetState._sendNextMessage (package:healthy_voice/ui/config/firmware_version.dart:179:18)
on ios socket.recv(); Cannot set timeout
when i use
socket.messages.listen((message) {
print('Received: $message');
// _sendNextMessage();
});
An error will be reported
E/flutter (18544): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ZeroMQException(156384763): Operation cannot be accomplished in current state
E/flutter (18544): #0 _checkErrorCode (package:dartzmq/src/exception.dart:56:5)
E/flutter (18544): #1 _checkReturnCode (package:dartzmq/src/exception.dart:49:5)
E/flutter (18544): #2 ZContext._poll (package:dartzmq/src/zeromq.dart:109:9)
E/flutter (18544): #3 ZContext._startPolling. (package:dartzmq/src/zeromq.dart:68:70)
E/flutter (18544): #4 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (18544): #5 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (18544): #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
Could it be that you are sending a null message? According to this EINTR
is thrown for a null message.
Could it be that you are sending a null message? According to this
EINTR
is thrown for a null message.
I'm going to abandon the synchronous method if I have data, but I get an error when I use asynchronous listening
E/flutter (18544): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ZeroMQException(156384763): Operation cannot be accomplished in current state
E/flutter (18544): #0 _checkErrorCode (package:dartzmq/src/exception.dart:56:5)
E/flutter (18544): #1 _checkReturnCode (package:dartzmq/src/exception.dart:49:5)
E/flutter (18544): #2 ZContext._poll (package:dartzmq/src/zeromq.dart:109:9)
E/flutter (18544): #3 ZContext._startPolling. (package:dartzmq/src/zeromq.dart:68:70)
E/flutter (18544): #4 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (18544): #5 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (18544): #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
I'm using the req/rep mode
Please use a dealer
socket instead of the req
socket when using the async socket
Please use a
dealer
socket instead of thereq
socket when using the async socket
When I used the sync mode, ios worked properly and Android reported an error as I mentioned above, and I couldn't set the timeout period, which would cause the program to get stuck
Could it be that you are sending a null message? According to this
EINTR
is thrown for a null message.
We have data. ios is working fine
socket.send(result);
Future.delayed(Duration(milliseconds: 1000),(){
final message = socket.recv();
print("getMessage $message");
});
I don't seem to have real synchronization on Android. I need to delay the recv() method to receive the data. If I call recv() directly, I get an error "EINTR: The operation was interrupted ", which is probably what you mean by null date because I'm not receiving data
I think we must ignore the EINTR
like it is done for the async sockets
Line 109 in 70030a9
Can you try adding that ignore?
I think we must ignore the
EINTR
like it is done for the async socketsLine 109 in 70030a9
Can you try adding that ignore?
I am very sorry for not replying to your message in time. I used ^1.0.0-dev.17 with _checkReturnCode(rc, ignore: [EAGAIN, EINTR]); But this error still occurs. Have you not repeated this error ?
I haven't tested it myself yet