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

Fix dtc_output read when interrupted by EINTR #1801

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarcoBonino
Copy link

The read() call may be interrupted by a signal, resulting in an EINTR error. In this case, read() will return -1 and set errno to EINTR. This is a common issue when dealing with I/O in a multi-process environment.

Check the error code returned by errno.
If it is EINTR, we can safely retry the read().

The read() call may be interrupted by a signal, resulting in an EINTR error.
In this case, read() will return -1 and set errno to EINTR.
This is a common issue when dealing with I/O in a multi-process environment.

Check the error code returned by errno.
If it is EINTR, we can safely retry the read().
Copy link
Collaborator

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are myriad I/O calls within Spike. I'm not yet convinced we need to solve this problem--can't we just be OK with it being undefined to send signals to Spike?--but if we do solve it, we should solve it systematically rather than providing a point solution to this one read call.

@MarcoBonino
Copy link
Author

There are myriad I/O calls within Spike. I'm not yet convinced we need to solve this problem--can't we just be OK with it being undefined to send signals to Spike?--but if we do solve it, we should solve it systematically rather than providing a point solution to this one read call.

The reason I write this fix was that when running spike using lldb debugger I was always getting -1 from the read, preventing the model to actually run.
Need to get more knowledge on the model before thinking if we can have the same in other parts of codebase.
For now that seems not creating problems (and it fixes the issue I had). Probably this issue happens when we interact with the DTC process.
An easy thing could be to wrap the call and not use it anymore directly, but I think that may be too big change and possibly may impact the model run.
In my opinion is better to fix it rather that waiting for a better fix that may not arrive soon. What about creating an "issue" to track that we would like to extend it to the whole codebase ?

@aswaterman
Copy link
Collaborator

Yeah, probably best to file an issue for the time being.

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

Successfully merging this pull request may close these issues.

2 participants