aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: aMuleWeb segfault when refreshing too frequently  (Read 1958 times)

visualage

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
aMuleWeb segfault when refreshing too frequently
« on: January 02, 2008, 10:21:30 AM »

The problem occurs in aMule-CVS-20080102.

I was using Firefox 2.0.0.11, and trying to cancel several downloads. What I did is following:
1. Click cancel,
2. wait to reload,
3. repeat from 1

After I deleted 3 or 4 downloads, amuleweb always crashes with following error
CFileImage: failed to open /usr/local/share/amule/webserver/default/dyn_B5C52BF0E82C36AAD9F67B513C9DE206.png

Program received signal SIGSEGV, Segmentation fault.

Of course, the hash string will change from time to time.

Below is the backtrace:
#0  0x000000000041a97e in CScriptWebServer::ProcessImgFileReq (this=0x7066e0,
    Data=@0x41400e10) at WebServer.cpp:299
#1  0x0000000000446d9f in CWebSocket::OnRequestReceived (this=0x8159f0,
    pHeader=0x7ccffe "HTTP/1.1\r\nHost: localhost:32001\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11\r\nAccept: image/png,*/*;q=0.5\r\nAccept-Language: zh-cn,en-us;q=0"...,
    pData=0x0, dwDataLen=0) at WebSocket.cpp:373
#2  0x000000000044764d in CWCThread::Entry (this=0x8159d0) at WebSocket.cpp:240
#3  0x00000036dd3f931d in wxThreadInternal::PthreadStart ()
   from /usr/lib64/libwx_baseu-2.8.so.0
#4  0x00000036dcf062ea in start_thread () from /lib64/libpthread.so.0
#5  0x00000036dc6cb73d in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()

The problem is caused by if the img is NULL while you are logged in, it still tries to send out the content of the image, which is wrong. Of course, the dyn_xxxxx may be specific to Firefox due to its background loading/caching stuff. Anyway, I believe the following patch can resolve the problem.

Code: [Select]
--- amule-cvs.orig/src/webserver/src/WebServer.cpp      2007-12-28 21:36:47.000000000 +0800
+++ amule-cvs/src/webserver/src/WebServer.cpp   2008-01-02 15:24:54.036206816 +0800
@@ -293,7 +293,7 @@

        // Only static images are available to visitors, in order to prevent
        // information leakage, but still allowing images on the login page.
-       if (session->m_loggedin || (img && dynamic_cast<CFileImage*>(img))) {
+       if (img && (session->m_loggedin || dynamic_cast<CFileImage*>(img))) {
                int img_size = 0;
                unsigned char* img_data = img->RequestData(img_size);
                // This unicode2char is ok.
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see
Re: aMuleWeb segfault when refreshing too frequently
« Reply #1 on: January 02, 2008, 06:11:05 PM »

visualage,

Your patch will be on tomorrow svn tarball. Please test and report.

Thanks for your support!
Logged