user623879
user623879

Reputation: 4142

C++ daemon forking causes mysql errors

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?

Upvotes: 0

Views: 381

Answers (1)

sehe
sehe

Reputation: 393064

Edit Oh, my apologies for misinterpreting

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

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.

Upvotes: 2

Related Questions