Had a potential GlusterFS user state that the filesystem incorrectly reported that a write succeeded even though all the servers were powered off. Since this sounded rather impossible, I asked for details and duplicated the problem. This is the php code:
<?php $fp = fopen("myfootest","c"); if (fwrite($fp,"Test1\n") === false) die("Write failed."); echo "First write completed. Turn off servers and press enter."; fgets(STDIN); if (fwrite($fp,"Test2\n") === false) die("Write failed."); if (fclose($fp) !== false ) { echo "File closed without error.\n"; } else { echo "Error closing file\n"; } ?>
After opening and writing to the file once, we wait for input and pull the plugs on the servers (I actually just kill -9 the glusterfsd and glusterd processes). Then we write to the file again and close the file. We expect that either the fwrite or at least the fclose are going to error. Unfortunately, “File closed without error.”
How can this be? Can we really be accepting this write even though it can’t be written?
An strace reveals what’s actually happening though. When I strace this code, here’s what really happens:
open("/mnt/myfootest", O_WRONLY|O_CREAT, 0666) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=6, ...}) = 0 lseek(3, 0, SEEK_CUR) = 0 write(3, "Test1\n", 6) = 6 write(1, "First write completed. Turn off "..., 56) = 56 read(0, "\n", 8192) = 1 write(3, "Test2\n", 6) = 6 close(3) = -1 ENOTCONN (Transport endpoint is not connected) write(1, "File closed without error.\n", 27) = 27
The writes don’t fail because they’re being cached. The fclose, however, is getting an error but is not passing that error along to the script. I believe that is this bug: https://bugs.php.net/bug.php?id=60110
2020 has not been a year we would have been able to predict. With a worldwide pandemic and lives thrown out of gear, as we head into 2021, we are thankful that our community and project continued to receive new developers, users and make small gains. For that and a...
It has been a while since we provided an update to the Gluster community. Across the world various nations, states and localities have put together sets of guidelines around shelter-in-place and quarantine. We request our community members to stay safe, to care for their loved ones, to continue to be...
The initial rounds of conversation around the planning of content for release 8 has helped the project identify one key thing – the need to stagger out features and enhancements over multiple releases. Thus, while release 8 is unlikely to be feature heavy as previous releases, it will be the...