aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Assertion Failure in AddSocket()  (Read 5319 times)

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Assertion Failure in AddSocket()
« on: December 08, 2008, 08:06:22 PM »

Using Amule 2.2.2 compiled from source on Ubuntu Intrepid AMD64.

Didn't crash anything but I couldn't connect to the webserver.

Code: [Select]
21:31:38: Debug: WebInterface.cpp(95): assert "(fd > 2) && (fd < 1024)" failed in AddSocket().
[Debug] Generating a stack trace... please wait[Thread 0x415c6950 (LWP 20728) exited]
WebInterface.cpp(95): assert "(fd > 2) && (fd < 1024)" failed in AddSocket().

Call stack:
[00] wxOnAssert(wchar_t const*, int, char const*, wchar_t const*, wchar_t const*)
[01] CSocketSet::AddSocket(GSocket*)          /home/jpv/src/aMule-2.2.2/src/webserver/src/WebInterface.cpp:97
[02] CWebserverGSocketFuncTable::AddSocket(GSocket*, GSocketEvent) /home/jpv/src/aMule-2.2.2/src/webserver/src/WebInterface.cpp:191
[03] CWebserverGSocketFuncTable::Install_Callback(GSocket*, GSocketEvent) /home/jpv/src/aMule-2.2.2/src/webserver/src/WebInterface.cpp:254
[04] CWebserverGSocketFuncTable::Enable_Events(GSocket*) /home/jpv/src/aMule-2.2.2/src/webserver/src/WebInterface.cpp:264
[05] GSocket::Connect(GSocketStream)         
[06] wxSocketClient::DoConnect(wxSockAddress&, wxSockAddress*, bool)
[07] CECMuleSocket::InternalConnect(unsigned int, unsigned short, bool) /home/jpv/src/aMule-2.2.2/src/libs/ec/cpp/ECMuleSocket.cpp:111
[08] CECSocket::ConnectSocket(unsigned int, unsigned short) /home/jpv/src/aMule-2.2.2/src/libs/ec/cpp/ECSocket.cpp:284
[09] CECMuleSocket::ConnectSocket(wxIPV4address&) /home/jpv/src/aMule-2.2.2/src/libs/ec/cpp/ECMuleSocket.cpp:103
[10] CRemoteConnect::ConnectToCore(wxString const&, int, wxString const&, wxString const&, wxString const&, wxString const&) /home/jpv/src/aMule-2.2.2/src/libs/ec/cpp/RemoteConnect.cpp:104
[11] CaMuleExternalConnector::ConnectAndRun(wxString const&, wxString const&) /home/jpv/src/aMule-2.2.2/src/webserver/src/../../../src/ExternalConnector.cpp:398

Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Assertion Failure in AddSocket()
« Reply #1 on: December 08, 2008, 08:10:32 PM »

Known issue, and will be fixed in 2.2.3.

Until then you may change the condition 'fd > 2' to 'fd > 0' in WebInterface.cpp at lines 95 and 116.
Logged
concordia cum veritate

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Assertion Failure in AddSocket()
« Reply #2 on: December 09, 2008, 06:59:11 AM »

Thanks for the heads up. I still have this problem with SVN r9248 and your fix doesn't seem to work, unless I did something wrong.

Code: [Select]
05:54:03: Debug: WebInterface.cpp(95): assert "(fd > 0) && (fd < 1024)" failed in AddSocket().
[Debug] Generating a stack trace... please waitHost: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 200 (Error: 0)
Download size: 6
HTTP download thread ended
WebInterface.cpp(95): assert "(fd > 0) && (fd < 1024)" failed in AddSocket().

Call stack:
[00] wxOnAssert(wchar_t const*, int, char const*, wchar_t const*, wchar_t const*)
[01] CSocketSet::AddSocket(GSocket*)          /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:97
[02] CWebserverGSocketFuncTable::AddSocket(GSocket*, GSocketEvent) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:191
[03] CWebserverGSocketFuncTable::Install_Callback(GSocket*, GSocketEvent) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:254
[04] CWebserverGSocketFuncTable::Enable_Events(GSocket*) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:264
[05] GSocket::Connect(GSocketStream)         
[06] wxSocketClient::DoConnect(wxSockAddress&, wxSockAddress*, bool)
[07] CECMuleSocket::InternalConnect(unsigned int, unsigned short, bool) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/libs/ec/cpp/ECMuleSocket.cpp:111
[08] CECSocket::ConnectSocket(unsigned int, unsigned short) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/libs/ec/cpp/ECSocket.cpp:286
[09] CECMuleSocket::ConnectSocket(wxIPV4address&) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/libs/ec/cpp/ECMuleSocket.cpp:103
[10] CRemoteConnect::ConnectToCore(wxString const&, int, wxString const&, wxString const&, wxString const&, wxString const&) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/libs/ec/cpp/RemoteConnect.cpp:104
[11] CaMuleExternalConnector::ConnectAndRun(wxString const&, wxString const&) /home/jpv/src/aMule-SVN-r9248-RELEASE-2_2_X/src/webserver/src/../../../src/ExternalConnector.cpp:398
Logged

lfroen

  • Guest
Re: Assertion Failure in AddSocket()
« Reply #3 on: December 09, 2008, 09:15:24 AM »

As you may see, there are 2 conditions that triggers this assertion:
* fd < 0 (technically possible since fd is an integer)
* fd > 1024

So, either you have more than 1023 sockets opened at the same time, or something got completely broken. Can you do "bt full" to see what value fd have?
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Assertion Failure in AddSocket()
« Reply #4 on: December 09, 2008, 08:26:47 PM »

I got it. The assertion condition should be changed to fd >= 0, otherwise the webserver crashes when launched by amule itself.

Two questions:

Shouldn't this be changed in SVN already, according to GonoszTopi comments? I don't see it. Also, like I said, it must be changed to fd>=0 and not fd>0 (since stdin can be piped, etc).

Is the second assertion condition really correct, fd < FD_SETSIZE? FD_SETSIZE seems to be the array length for storing file descriptors, why would that be related to the file descriptor value itself? Just checking on this.
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Assertion Failure in AddSocket()
« Reply #5 on: December 09, 2008, 08:35:07 PM »

Oops, spoke too soon, another webserver crash on a different assertion when connecting. I'll take a better  look at it.
Logged

lfroen

  • Guest
Re: Assertion Failure in AddSocket()
« Reply #6 on: December 09, 2008, 09:07:47 PM »

Is the second assertion condition really correct, fd < FD_SETSIZE? FD_SETSIZE seems to be the array length for storing file descriptors, why would that be related to the file descriptor value itself? Just checking on this.
You should be checking man page for select() call.
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Assertion Failure in AddSocket()
« Reply #7 on: December 10, 2008, 12:01:35 AM »

I got it. The assertion condition should be changed to fd >= 0, otherwise the webserver crashes when launched by amule itself.
My fault, I skipped the '=' sign somehow.

Shouldn't this be changed in SVN already, according to GonoszTopi comments? I don't see it.
It was already, but only in trunk. Since rev. 9252, it's in the 2.2x branch too.
Logged
concordia cum veritate

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Assertion Failure in AddSocket()
« Reply #8 on: December 10, 2008, 01:19:29 AM »

So with rev. 9252 that problem is fixed but I have the new assertion failure I just mentioned.

Code: [Select]
00:10:56: Debug: WebInterface.cpp(122): assert "m_fds[i] == fd" failed in RemoveSocket().
[Debug] Generating a stack trace... please waitWebInterface.cpp(122): assert "m_fds[i] == fd" failed in RemoveSocket().

Call stack:
[00] wxOnAssert(wchar_t const*, int, char const*, wchar_t const*, wchar_t const*)
[01] CSocketSet::RemoveSocket(GSocket*)      /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:123
[02] CWebserverGSocketFuncTable::RemoveSocket(GSocket*, GSocketEvent) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:202
[03] CWebserverGSocketFuncTable::Uninstall_Callback(GSocket*, GSocketEvent) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/WebInterface.cpp:259
[04] GSocket::Read(char*, int)               
[05] wxSocketBase::_Read(void*, unsigned int)
[06] wxSocketBase::Read(void*, unsigned int)
[07] CECMuleSocket::InternalRead(void*, unsigned long) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/libs/ec/cpp/ECMuleSocket.h:58
[08] CECSocket::SocketRead(void*, unsigned long) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/libs/ec/cpp/ECSocket.h:199
[09] CQueuedData::ReadFromSocketAll(CECSocket*, unsigned long) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/libs/ec/cpp/ECSocket.cpp:207
[10] CECSocket::SendRecvPacket(CECPacket const*) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/libs/ec/cpp/ECSocket.cpp:311
[11] CaMuleExternalConnector::SendRecvMsg_v2(CECPacket const*) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/../../ExternalConnector.h:138
[12] php_get_amule_categories(PHP_VALUE_NODE*) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_amule_lib.cpp:294
[13] php_run_func_call                        /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_syntree.cpp:1759
[14] php_expr_eval                            /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_syntree.cpp:1325
[15] php_expr_eval                            /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_syntree.cpp:1273
[16] php_execute                              /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_syntree.cpp:1792
[17] CPhPLibContext::Execute(CWriteStrBuffer*) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_core_lib.cpp:548
[18] CPhpFilter                              /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/php_core_lib.cpp:626
[19] CScriptWebServer::ProcessPhpRequest(char const*, CSession*, long&) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/WebServer.cpp:1798
[20] CScriptWebServer::ProcessURL(ThreadData) /home/jpv/src/aMule-SVN-r9252-RELEASE-2_2_X/src/webserver/src/WebServer.cpp:1917

This happens when connecting to the webserver.
« Last Edit: December 10, 2008, 01:21:13 AM by jpv950 »
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Assertion Failure in AddSocket()
« Reply #9 on: December 10, 2008, 05:24:52 AM »

Still only crashes when launching amuleweb automatically with amule.
Logged