Skip to content

Commit

Permalink
Handle interrupted read for spawn status. Fixes #3292.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Jan 21, 2015
1 parent 6d1c999 commit db5a44e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions vm/builtin/system.cpp
Expand Up @@ -488,7 +488,18 @@ namespace rubinius {
state->shared().auxiliary_threads()->after_fork_exec_parent(state);

int error_no;
ssize_t size = read(errors[0], &error_no, sizeof(int));
ssize_t size;

while((size = read(errors[0], &error_no, sizeof(int))) < 0) {
switch(errno) {
case EAGAIN:
case EINTR:
continue;
default:
utilities::logger::error("%s: spawn: reading error status", strerror(errno));
break;
}
}
close(errors[0]);

if(size != 0) {
Expand Down Expand Up @@ -613,7 +624,18 @@ namespace rubinius {
state->shared().auxiliary_threads()->after_fork_exec_parent(state);

int error_no;
ssize_t size = read(errors[0], &error_no, sizeof(int));
ssize_t size;

while((size = read(errors[0], &error_no, sizeof(int))) < 0) {
switch(errno) {
case EAGAIN:
case EINTR:
continue;
default:
utilities::logger::error("%s: backtick: reading error status", strerror(errno));
break;
}
}
close(errors[0]);

if(size != 0) {
Expand Down

4 comments on commit db5a44e

@Pugio
Copy link

@Pugio Pugio commented on db5a44e Jan 21, 2015

Choose a reason for hiding this comment

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

Cool.
I'm new to the codebase - is the check_async not necessary for errors? (I'm not really sure what it's for.)

@brixen
Copy link
Member Author

@brixen brixen commented on db5a44e Jan 22, 2015

Choose a reason for hiding this comment

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

No, it's not necessary to handle the interrupted reads here and this case is extremely rare. The signals will get processed eventually elsewhere.

What were you doing to "rapidly resize" your window anyway?

@Pugio
Copy link

@Pugio Pugio commented on db5a44e Jan 22, 2015

Choose a reason for hiding this comment

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

I was just clicking and dragging. To test it I moved my mouse around the screen quickly and erratically, but you could trigger the exception with a fairly normal click-on-edge-and-drag to resize. In my report, "rapid" more meant "not really slowly".

@brixen
Copy link
Member Author

@brixen brixen commented on db5a44e Jan 22, 2015

Choose a reason for hiding this comment

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

@Pugio ah, ok. Well, it's a pretty interesting edge-case I hadn't considered, so thanks for finding it!

Please sign in to comment.