Description of problem: ./tests/basic/gfapi/bug1291259.t fails in regression tests often and is currently marked bad. The failure log always indicates a segfault as follows, 22:13:13 ================================================================================ 22:13:13 [06:13:13] Running tests in file ./tests/basic/gfapi/bug1291259.t 22:13:19 Starting libgfapi_fini 22:13:19 glfs_set_volfile_server : returned 0 22:13:19 glfs_set_logging : returned 0 22:13:19 glfs_init : returned 0 22:13:19 glfs_h_poll_upcall : returned 0 22:13:19 glfs_set_volfile_server : returned 0 22:13:19 glfs_set_logging : returned 0 22:13:19 glfs_init : returned 0 22:13:21 glfs_h_lookupat leaf : returned -1 22:13:21 glfs_h_create leaf - 0x2205ed0 22:13:21 glfs_h_poll_upcall : returned 0 22:13:21 ./tests/basic/gfapi/../../include.rc: line 286: 25897 Segmentation fault ././tests/basic/gfapi/bug1291259 slave20.cloud.gluster.org patchy /var/log/glusterfs/bug1291259.log 22:13:22 ./tests/basic/gfapi/bug1291259.t .. 22:13:22 1..10 22:13:22 ok 1, LINENUM:8 22:13:22 ok 2, LINENUM:10 22:13:22 ok 3, LINENUM:11 22:13:22 ok 4, LINENUM:13 22:13:22 ok 5, LINENUM:14 22:13:22 ok 6, LINENUM:19 22:13:22 ok 7, LINENUM:21 22:13:22 not ok 8 , LINENUM:23 22:13:22 FAILED COMMAND: ././tests/basic/gfapi/bug1291259 slave20.cloud.gluster.org patchy /var/log/glusterfs/bug1291259.log 22:13:22 ok 9, LINENUM:27 22:13:22 ok 10, LINENUM:28 22:13:22 Failed 1/10 subtests
The cause of failure or crash is as follows, bug1291259.c calls glfs_h_poll_upcall (line 128), and checks if ret is non-zero before calling glfs_upcall_get_reason. The latter dereferences the inarg (cbk) and causes a crash as that is NULL. The reason for cbk to be NULL, is due to the fact that poll_upcall has not returned any data and still returns a ret of 0. The consumer (the test program in this case) is meant to either check errno or if cbk is non-NULL before processing the event. As the check is missing this crashes at times and hence causes the regression failure.
*** This bug has been marked as a duplicate of bug 1405301 ***