PDA

View Full Version : GLib-WARNING **: poll(2) failed due to: Invalid argument.



December
6th April 2008, 07:55
I am writing a server application, but have run into a problem.

When I reach about 850 connection, the program jumps to using a lot of CPU, and I get a deluge of the following message:

(process:9804): GLib-WARNING **: poll(2) failed due to: Invalid argument.

I've no idea where that could be coming from, does anyone know what might actually cause that?

wysota
6th April 2008, 10:33
Could be that a large number of sockets is causing this. The amount of sockets you may open (and handle) at the same time is often limited. Maybe you reached some limit.

December
8th April 2008, 03:53
It does seem to be that. When I compiled and ran it on another machine that had a customized kernel to allow more Sockets, I didn't run into the same problem.

So how can I detect this problem is occurring and have my program take steps to prevent this crash?

QTcpServer does not seem to have any onError signals :-(

wysota
8th April 2008, 09:48
So how can I detect this problem is occurring and have my program take steps to prevent this crash?
As for Linux, you can query /proc or /sys for the number of allowed file descriptors per process. As for other OSes, I have no idea. Do you really need such a large number of sockets?


QTcpServer does not seem to have any onError signals :-(

You can access the error from the regular socket (See QAbstractSocket::error ()).

jay
17th February 2009, 06:10
I am getting the same error "(process:2795): GLib-WARNING **: poll(2) failed due to: Invalid argument." , when the connection exceeds 550.

Is the "Kernel rebuilding by allowing more sockets" only solves the problem? or any other way to solve this?

Note:
I am running this in Slackware.