Fix #9678
closederrno shadowed in Pipe.cc
0%
Description
In some places errno is used after it has been reset and the original error code does not show in the message. For instance https://github.com/ceph/ceph/blob/giant/src/msg/Pipe.cc#L1473
2014-10-07 14:37:05.473776 7facdbf15700 2 -- 192.168.99.252:6805/25809 >> 192.168.99.251:0/2012331 pipe(0x7fad20850800 sd=138 :6805 s=4 pgs=47 cs=1 l=1 c=0x7fad22fa1b20).reader couldn't read tag, (0) Success
Updated by Loïc Dachary over 9 years ago
- Subject changed from errno shadowd in Pipe.cc to errno shadowed in Pipe.cc
Updated by Greg Farnum over 9 years ago
Where's it being reset? That error message is admittedly strange but it actually happens because the underlying function can return without it being an error. (I don't remember exactly how, but I think it's if the other end closes a socket we wake up without error codes but then we return -1 because there's no data available to read.)
Updated by Loïc Dachary over 9 years ago
- Priority changed from High to Normal
- Backport deleted (
firefly, giant)
If it is expected to see an error message when there is nothing to read, then I was mistaken.
Not retrieving the content of errno opens the possibility that other system calls happen in between (if not now then when the code being called in between evolve), making it unreliable to read afterwards.
Feel free to reject if you think this is not a concern.
Updated by Greg Farnum about 5 years ago
- Project changed from Ceph to Messengers
- Category deleted (
msgr)