-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event loop's epoll FD inherited from main process not closed in worker #85
Comments
Looking at SID run, there are still 4 references left right before we call
|
The extra references are internal references held by various |
related to issue #108 |
@trgill, @prajnoha, here's my current plan for cleaning this up. in worker_control_get_new_worker():
in sid.c:main():
In new funtion.
See any issues with this? |
Unfortunately, the It looks that the |
The |
Oh. Thanks for the heads-up. I'm going to play around to make sure, but it just looks like we can skip calling Here's the code from And here's the code from So, the next time sd_event_loop() checks for an event, it will exit in the child process. |
@prajnoha, I have another question. Do we really want to support external workers? I could see supporting external modules, where the worker process executed a binary. We could have some defined format for how the binary wrote it's changes, and the worker process could take those and send them back to udev and the database. But I don't see the benefit of having a separate binary to take on all the tasks of a worker. Did you have something specific in mind for external workers? |
...yes, we can give it a try, looks promising. Maybe the only issue could be that if we try to destroy a resource in the child (the resource cleanup we do in Now, in the worker/child, if we know which FDs belong to the channels we need for worker <--> main communication, we can probably try to close all the remaining FDs there, which would also include the inherited/duplicated FD for the sd-event loop's epoll handle and other related FDs which got duplicated. |
I meant to generalize the "worker" to include execution of both internal and external (external binaries) code. Then on the main "control" side, the tracking has the same interface:
In the future, I'd like to add timeouts for both internal and external workers with actions on what should be done when the timeout is reached. Also, adding follow-up actions - e.g. when execution of one worker stops, we can make another worker to start in sequence (or start an associated action). So having the same interface for controlling both internal and external workers simply makes the interface uniform so it's easier to add common functionality later (like those timeouts, follow-up actions etc.). |
Recently, we have resolved #33 which dealt with signal handling cleanup in worker after
fork
- that works fine now. But there's one more thing - even though we call the cleanup in the worker right at its initialization:sid/src/resource/ubridge.c
Lines 3950 to 3951 in 8a5f96a
...everything is cleaned up except the inherited
epoll
FD backing up the event loop in main process. Quick debug shows that we really callsid_resource_destroy
withsd_event_unref
inside which is called:sid/src/resource/resource.c
Lines 325 to 326 in 8a5f96a
But checking the
/proc/<worker_process_pid>/fd
, it shows theepoll
FD is still there...The text was updated successfully, but these errors were encountered: