Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6663379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:29:33+00:00 2026-05-26T02:29:33+00:00

I have a daemon that forks the process. This daemon access a database using

  • 0

I have a daemon that forks the process.

This daemon access a database using mysql connector library.

When I do not fork, I am able to open and read a database fine, however, when I fork, I get

MySQL server has gone away 

errors consistently on the first query…

Anyone know what could be causing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:29:34+00:00Added an answer on May 26, 2026 at 2:29 am

    Edit Oh, my apologies for misinterpreting

    Still the problems with differences between daemonized/non-daemonized are roughly with the following class of options:

    • environment variables
      • LIBPATH
      • PATH
      • HOME, UID, EUID (HOME surprisingly enough gets (ab)used way too often)
      • mysql specific variables
    • permissions
      • what user is the daemon running as? elevated or privilege separation?
    • current working directory (traditionally / for daemons, where / might be a chroot jail instead of ‘real’ /)
    • Starting with kernel 2.4.19, Linux provides per-process mount namespaces. A
      mount namespace is the set of file system mounts that are visible to a
      process. Mount-point namespaces can be (and usually are) shared between
      multiple processes, and changes to the namespace (i.e., mounts and unmounts)
      by one process are visible to all other processes sharing the same namespace.
      (The pre-2.4.19 Linux situation can be considered as one in which a single
      namespace was shared by every process on the system.)

    • detached stdin/stdout causing trouble (IMO that would mean badly designed library, but who am I)

    • watch it that specific resources (file locks, socket connections, threads (!)) are NOT inherited across fork/execve. I recommend reading the linked on daemonization (below), especially for example the section on ‘Mutual Exclusion and Running a Single Copy [open,lockf,getpid]’

    I’m sure I’m forgetting stuff

    Ermm… what are you starting a mysql server process for? Mysql has plenty of sound init scripts that do work.

    On the subject of proper daemonization: http://www.enderunix.org/docs/eng/daemon.php

    Pay attention to the effects of sharing resources with fork children (e.g. file descriptors).

    Besides that, you could just be missing basic environment settings. Peruse the official init scripts for mysql to find out which you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Linux daemon that forks a few children and monitors them for
I have a daemon that I'm starting along with the server using an initializer
I have a ruby daemon that selects 100 records from database and do a
I am going to have a daemon that will run on a FreeBSD server,
I have a small daemon that I'm writing in C and I need a
I have several init.d scripts that I'm using to start some daemons. Most of
I have a Solaris daemon written in Java6. Clients can connect to it using
I have a simple Perl script which runs as a Linux daemon using an
I am using exec() inside a a script that runs as a daemon and
I have a daemon that is running as user nobody. It needs to copy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.