Bug #93935 Contribution: my_fclose - retry on close fail like my_close
Submitted: 15 Jan 13:33 Modified: 4 Feb 12:58
Reporter: OCA Admin (OCA) Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[15 Jan 13:33] OCA Admin
This bug tracks a contribution by Daniel Black (Github user: grooverdan) as described in http://github.com/mysql/mysql-server/pull/242

How to repeat:
See description

Suggested fix:
See contribution code attached
[15 Jan 13:33] OCA Admin
Contribution submitted via Github - my_fclose - retry on close fail like my_close 
(*) Contribution by Daniel Black (Github grooverdan, mysql-server/pull/242#issuecomment-454262736): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_244670856.txt (text/plain), 843 bytes.

[15 Jan 13:44] Miguel Solorzano
Thank you for contribution.
[4 Feb 11:13] Tor Didriksen
'man 2 close' on my fedora box says:

Retrying  the close() after a failure return is the wrong thing to do, since this may cause a reused file descriptor from another thread
       to be closed.  This can occur because the Linux kernel always releases the file descriptor early in the close operation, freeing it  for
       reuse; the steps that may return an error, such as flushing data to the filesystem or device, occur only later in the close operation.
[4 Feb 12:58] Ståle Deraas
Posted by developer:
Given the above info, we close this bug
[5 Feb 21:25] Daniel Black
Interesting. Thank you for the explanation.

As this is the case, the my_close implementation needs to be fixed to prevent a retry.
[6 Feb 17:18] Ståle Deraas
Posted by developer:
Yes, I agree Daniel
[17 May 4:50] Daniel Black
The loop around close in my_close (mysys/open.cc) isn't removed in 8.0.16