-
Notifications
You must be signed in to change notification settings - Fork 76
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
Improve connection cleanup to avoid many error messages with ioc exit on some operating systems #200
Improve connection cleanup to avoid many error messages with ioc exit on some operating systems #200
Conversation
❌ Build asyn 1.0.254 failed (commit 6eb168c10f by @FreddieAkeroyd) |
I like the general idea. It won't work on Linux, however. It might on Darwin, or it might not; I don't have a Mac to test on. The reason is that @jlmuir, if your're testing this, and if it works, you should expect to see one or two errors that occur when the Footnotes
|
Ah thanks, I see why linux did not error then, it just stayed blocked until the process died. Maybe adding Another option is to make the loop non-blocking by adding a select() with timeout, so accept is only called if there is a connection to accept, and fd can then be checked every timeout |
❌ Build asyn 1.0.255 failed (commit 3ab9652411 by @FreddieAkeroyd) |
@exzombie, I confirm that the three commits from @FreddieAkeroyd in this PR help on
Here's the full terminal session:
|
The appveyor Windows builds are failing because it cannot find "distutils". Does anyone know how to fix this? |
Re the AppVeyor build failures, if the version of Python in the AppVeyor build VM is >= 3.12, maybe because the |
I found that the latest version of ci-scripts (v3.4.1) removes the dependency on distutils. I have changed asyn to use the latest version of ci-scripts, and I suspect that will fix the problem with Appveyor. |
@jlmuir good to hear that works, though on reflection I think the suggestion of @exzombie to use
|
Though we may need a delay between |
✅ Build asyn 1.0.258 completed (commit 5de03a8e3b by @FreddieAkeroyd) |
Have pushed change to use |
✅ Build asyn 1.0.259 completed (commit a4eaa554f0 by @FreddieAkeroyd) |
Tried with commit 7f89753 on
|
Yes, it will print a few more messages as the
|
✅ Build asyn 1.0.260 completed (commit a5ae66288d by @FreddieAkeroyd) |
Tried with commit 19db7d3 on
|
@jlmuir thank you for testing and a happy new year to you. So now the only messages printed are from |
Looks ok to me; I'm not a fan of using sleep to synchronize threads, but that's the least intrusive approach. I've had enough "fun" trying to fix broken (in theory) locking in #171 to push for a proper solution here 😅 I was thinking a bit about what it would mean if
Given the existence of the RTEMS workaround, surely adding |
@FreddieAkeroyd wrote:
Yes, I confirm that if I comment out the
|
Ping? Anything else needed here? Could this be merged? Thanks! |
Since I am late to this party, these will have to be notes for future work.
Not that I am aware of. As was noted above, interrupting blocking syscalls is not especially portable to OS or socket type. The awkward |
asynPrint(pasynUser, ASYN_TRACE_FLOW, | ||
"drvAsynIPServerPort: terminating connection thread for %s\n", | ||
tty->serverInfo); | ||
break; /* we must be in ioc shutdown and ttyCleanup has been called */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... or maybe the file descriptor limit was reached and accept() has returned with errno==EMFILE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add a separate test for this condition when we check clientFd
at https://github.com/FreddieAkeroyd/asyn/blob/19db7d33e5576393f99feeb196f88b7d321e5a95/asyn/drvAsynSerial/drvAsynIPServerPort.c#L336 or would this situation also affect tty->fd
?
Try to terminate accept thread during cleanup