[MDEV-25330] fflush(stderr) call improvement in signal_handler.cc Created: 2021-04-02  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-24199 MariaDB Server fails to write a core ... Stalled

 Description   

In https://github.com/MariaDB/server/blob/10.6/sql/signal_handler.cc, the following flush happens in one case:

#else
  char buff[80];
  my_getwd(buff, sizeof(buff), 0);
  my_safe_printf_stderr("Writing a core file at %s\n", buff);
  fflush(stderr);                                                                          <<<<<<<<<<<<<<<<<<
#endif

Yet, there are three other parts just above it that also write to stderr in similar ways, and that do not flush stderr.

Suggested fix; either add fflush(stderr); to the other three parts above it too, or move the fflush(stderr); to just outside the #endif so it may always be called irrespective (best solution imho; less code duplication and future proof)



 Comments   
Comment by Daniel Black [ 2021-04-03 ]

not sure why a fflush is needed at all. stderr is mean to be unbuffered in the standard I think.

Comment by Daniel Black [ 2021-04-06 ]

Thought this sounded familiar - https://github.com/MariaDB/server/pull/761

Contains std references.

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