Poco AsyncChannel does not exit on forked process exit

ashish behl

Problem:

Call/Initialize Poco code from inside a C library, using loader (3rd party C program, our code is in c++).

  1. The Program loads our library, our lib initializes Poco::Logger and uses AsyncChannel + FileChannel in the logger.
  2. Fork from this process.
  3. Run some threads in the child process.
  4. try to exit the child process, joining threads.
  5. The AsyncChannel's destructor blocks on close(), essentially polling Queue and sleeping.
  6. The _queue has 1 element always when the destructor for AsyncChannel is called, and I assume that is due to the way the parent process is running and forking.

Now the question: Is this a problem with gcc that Forking a process does not call the constructors and just duplicates the memory? I have tried calling _queue.clear() inside AsyncChannel::AsyncChannel() but no results...

Has anyone seen this problem before? any proposed solution?

ashish behl

Response here:

http://pocoproject.org/forum/viewtopic.php?f=10&t=6378

Summary: create threads after fork and not before. Same problem with Poco::Util::Timer and other classes also.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

exit child process, safely

From Dev

Should I be terminating a forked child process with exit()?

From Dev

Expected process to exit with [0], but received ''

From Dev

Wait for all child process to exit

From Dev

process exit and impact on threads

From Dev

Python process does not exit on GTK loop exit

From Dev

How to prevent grunt process exit?

From Dev

QDialog exec() can not exit process

From Dev

Getting exit code of a terminated process

From Dev

Parent process does not wait for all children to exit using signal()

From Dev

PhantomJS Process doesn't exit

From Dev

shell process not exiting on `exit` inside `$()`

From Dev

Is it possible to dump the core but not exit the process?

From Dev

embedmongo with reactivemongo process does not exit

From Dev

Tcsh script does not exit

From Dev

Get exit status of a process in bash

From Dev

Does a PHP process exit when you ctrl + c it from CLI?

From Dev

Spawn interactive process and exit in NodeJS

From Dev

Why does `exit &` not work?

From Dev

Why does ( exit 1 ) not exit the script?

From Dev

bash does not exit on abnormal exit of child process due to signal

From Dev

Wait for process to exit

From Dev

Should I be terminating a forked child process with exit()?

From Dev

Get the exit code of processes forked from the master process

From Dev

Wait multiple process, print exit code if any process get exit

From Dev

Exit script from a backgrounded process?

From Dev

How to exit a process after disown

From Dev

Exit nightwatch cucumber process with exit code 0?

From Dev

Process Substitution and Exit Codes