aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/driver_SUITE_data
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-02-15 14:48:08 +0100
committerSverker Eriksson <[email protected]>2011-02-21 16:01:35 +0100
commit1580937874b35350c0ff5c2a72b2540d7ec28378 (patch)
tree86b7526c58488095e37335d7d5c669a61bc656f3 /erts/emulator/test/driver_SUITE_data
parentcd7fc2cb900dcd296f2ba215dea1c691440107d0 (diff)
downloadotp-1580937874b35350c0ff5c2a72b2540d7ec28378.tar.gz
otp-1580937874b35350c0ff5c2a72b2540d7ec28378.tar.bz2
otp-1580937874b35350c0ff5c2a72b2540d7ec28378.zip
Allow unexpected driver input event in driver_SUITE:smp_select
epoll on Linux has been seen to sometimes trigger unexpected events. Most of the time these events are filtered by erl_check_io, but may slip up to the driver in cases when fd's are reused. Also made clear in driver docs that spurious events may happen.
Diffstat (limited to 'erts/emulator/test/driver_SUITE_data')
-rw-r--r--erts/emulator/test/driver_SUITE_data/chkio_drv.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/erts/emulator/test/driver_SUITE_data/chkio_drv.c b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
index b571cb30e6..bbdb09cfcb 100644
--- a/erts/emulator/test/driver_SUITE_data/chkio_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
@@ -102,6 +102,7 @@ typedef struct chkio_smp_select {
int write_fd;
int next_read;
int next_write;
+ int first_write;
enum {Closed, Opened, Selected, Waiting} state;
int wasSelected;
unsigned rand_state;
@@ -577,9 +578,16 @@ chkio_drv_ready_input(ErlDrvData drv_data, ErlDrvEvent event)
inPipe = (pip->next_write - pip->next_read);
if (inPipe == 0) {
bytes = read(pip->read_fd, &word, sizeof(word));
- printf("Unexpected empty pipe, expected %u -> %u, bytes=%d, word=%d\n",
- pip->next_read, pip->next_write-1, bytes, word);
- abort();
+ printf("Unexpected empty pipe, expected %u -> %u, bytes=%d, word=%d, written=%d\n",
+ pip->next_read, pip->next_write-1, bytes, word,
+ (pip->next_write - pip->first_write));
+ /*abort();
+ Allow unexpected events as it's been seen to be triggered by epoll
+ on Linux. Most of the time the unwanted events are filtered by
+ the erl_check_io layer. But when fd's are reused the events may
+ slip up to the driver.
+ */
+ break;
}
n = rand_r(&pip->rand_state) % (inPipe*4);
@@ -1252,6 +1260,7 @@ chkio_drv_control(ErlDrvData drv_data,
pip->state = Opened;
pip->wasSelected = 0;
pip->next_write = pip->next_read = rand_r(&pip->rand_state) % 1024;
+ pip->first_write = pip->next_write;
if (op & 1) break;
op >>= 1;
}/*fall through*/