[MDEV-23284] EBADF on all tests on AIX Created: 2020-07-24  Updated: 2022-04-04  Resolved: 2022-04-04

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.5.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Etienne Guesnet Assignee: Daniel Black
Resolution: Won't Fix Votes: 0
Labels: not-10.5
Environment:

POWER_PPC64, AIX 7.1, GCC 8.4



 Description   

Hi,

On AIX, all tests fail with an EBADF:

[ERROR] Error in accept: Bad file number

The error is from handle_connections_sockets() function in sql/mysqld.cc. This function has been rewritten in 10.5.
If I compare https://github.com/MariaDB/server/blob/10.4/sql/mysqld.cc#L6549 and https://github.com/MariaDB/server/blob/10.5/sql/mysqld.cc#L6262, I think the logic is not the same.
In particular, if getting fd is a success, the loop is over on 10.4, and the loop retries in 10.5.
It causes the EBADF on AIX. The following patch corrects the trouble on AIX and does not affect Linux tests result.

--- ./sql/mysqld.cc.orig        2020-07-10 13:26:15 +0200
+++ ./sql/mysqld.cc     2020-07-10 16:57:03 +0200
@@ -6260,8 +6260,8 @@
           sql_perror("Error in accept");
         if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
           sleep(1); // Give other threads some time
-        break;
       }
+      break;
     }
   }
   sd_notify(0, "STOPPING=1\n"

I think this patch restores the same logical between 10.4 and 10.5.

Tested on:
AIX configuration: POWER_PPC64, AIX 7.1, GCC 8.4
Linux configuration: x86_64, Fedora 31, 9.3



 Comments   
Comment by Etienne Guesnet [ 2022-01-27 ]

This bug cannot be reproduced on 10.5.13.

Comment by Etienne Guesnet [ 2022-01-28 ]

AIX is not supported on 10.4. I think this bug is no more relevant.
The error has disappeared after an update (I do not remember which one). We have worked with my colleagues to understand this bug but it is abstruse.

Comment by Daniel Black [ 2022-04-04 ]

Thanks EGuesnet

Generated at Thu Feb 08 09:21:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.