Re: [gtkmm] app calls poll() for disconnected connections



Am 24.09.2002 21:59 schrieb(en) Eric Buddington:
stracing my app, I see incessant (to the point of using all CPU time)
poll() calls that are returning POLLNVAL for file descriptors that
should no longer be watched. Specifically, my main app forks off
children and tries to communicate with them via pipes.

In this case, file descriptors 7, 9, and 11 are pipes from short-lived
children, and 13 and 15 are pipes to long-lived children. Each
initially is watched by a Connection, created as:

input_connection = Glib::signal_io().connect
    (SigC::slot(*this, &PluginProxy::on_output),
     from_child_fd(),
     Glib::IO_IN | Glib::IO_OUT | Glib::IO_PRI | Glib::IO_ERR |
Glib::IO_HUP);

All correctly note the "Broken Pipe" error when the child dies, and all
have disconnect() called on them at that point. After this point, the
'on_output' function is no longer called, but the poll() still watches
the fds and sucks cycles:

poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN, revents=POLLNVAL},
{fd=9, events=POLLIN, revents=POLLNVAL}, {fd=11, events=POLLIN,
revents=POLLNVAL}, {fd=13, events=POLLIN}, {fd=15, events=POLLIN}], 6,
-1) = 3

Shouldn't GTK stop watching the fd as soon as I call disconnect() on
the Connection?

I can't find a bug while reading and thinking over the codebase.

SigC::Connection::disconnect() calls
{anonymous}::SourceConnectionNode::notify(false) calls
g_source_destroy(source_) calls
g_source_destroy_internal(source, context, FALSE) calls
g_main_context_remove_poll_unlocked(context, tmp_list->data)

The last function should remove the file descriptors from the poll table.
Obviously it never gets executed - I don't see why.

Could you please file a bug report at bugzilla and provide a simple
testcase? I looks like I had to debug the problem in order to solve it.
You can put my email-adress in the CC field of your bug report.

Regards,

  Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]