Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Kea Kea
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 555
    • Issues 555
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 66
    • Merge requests 66
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • KeaKea
  • Issues
  • #2034
Closed
Open
Issue created Aug 17, 2021 by Andrei Pavel@andreiMaintainer

atexit(mysql_library_end) is never called

Discovered through a compile warning that says:

static bool isc::db::MySqlHolder::<lambda()>::_FUN()’ will never be NULL

for this line:

bool MySqlHolder::atexit_ = []{atexit([]{mysql_library_end();});return true;};

What it's saying is that the address of the lambda is always different than zero. Which gets casted to a true when assigned to atexit_. That's not the concerning part. To the best of my understanding, the lambda never gets called here. And so atexit() is never called. And so mysql_library_end() never gets called. Quote from the MySQL docs:

To avoid memory leaks after the application is done using the library (for example, after closing the connection to the server), be sure to call mysql_library_end() explicitly. This enables memory managment to be performed to clean up and free resources used by the library.

So this could be a socket leak? If I remember, unclosed sockets outlive the process.

Compiler is g++11, but I remember getting it in previous versions also. Flags are -Wall -Wextra, but they might not be required.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking