[Mono-list] Memory leak with mod_mono

Russell rusvdw at gmail.com
Tue Dec 11 15:03:08 EST 2007


I've performed a trace on the application in order to attempt to see what is
happening when the memory increases.

The symptoms are this: Start XSP2, open a page (in the test a default blank
aspx file). After the page is loaded, watch the memory consumption slowly
increase (and never decrease). My assumption is that there is a thread or
something running in the background that keeps increasing the memory usage.

In order to get the trace file, i performed the following:

root at ruski:/var/www/web4/web# mono --debug --trace=disabled
/usr/local/lib/mono/2.0/xsp2.exe > trace.log

Once the page is loaded, send the trace flag to the process:

root at ruski:/var/www/web4/web# kill -USR2 1355

After a couple of seconds, stop the process.

It appears that there are only XSP activities going on in the background,
none from the application. The trace.log file can be downloaded from here:

http://cid-59ce694532a3fbb0.skydrive.live.com/self.aspx/mono/trace.zip

if that link doesn't work, try

http://qi80ra.bay.livefilestore.com/y1pQiL-yfzLXd7HPuDsk3klGs9iVIw75Hq3_hFtuRhRKWwDj0BaGGtSixhYza5IAHEFYH4ctw23BZKOHZ6eBPYrTw/trace.zip?download

I would appreciate it if you could give it a look over and let me know if
anything strange is happening there.

Regards
   Russell

On Dec 11, 2007 8:39 PM, Russell <rusvdw at gmail.com> wrote:

> Oops, seems I haven't been including the list in posting. See below!
>
>
> On Dec 11, 2007 8:37 PM, Russell <rusvdw at gmail.com> wrote:
>
> > Rodrigo,
> >
> > Sorry for the long delay, but my day job has had me a bit swamped of
> > late (and it took a while to figure out the whole gdb thing).
> >
> > Managed stack trace with debug:
> >
> > root at ruski:/var/www/web4/web# mono --debug --profile=heap-buddy:
> > heap.log /usr/local/lib/mono/2.0/xsp2.exe
> > *** Running with heap-buddy ***
> > xsp2
> > Listening on port: 8080 (non-secure)
> > Listening on address: 0.0.0.0
> > Root directory: /var/www/web4/web
> > Hit Return to stop the server.
> > Stacktrace:
> >
> >   at (wrapper managed-to-native)
> > System.Net.Sockets.Socket.LocalEndPoint_internal (intptr,int&) <0x00004>
> >   at (wrapper managed-to-native)
> > System.Net.Sockets.Socket.LocalEndPoint_internal (intptr,int&)
> > <0xffffffff>
> >   at System.Net.Sockets.Socket.get_LocalEndPoint () [0x00027] in
> > /src/mono-1.2.5.1/mcs/class/System/System.Net.Sockets/Socket.cs:1099
> >   at Mono.WebServer.XSPWebSource.CreateWorker (System.Net.Sockets.Socket
> > ,Mono.WebServer.ApplicationServer) [0x00000] in /src/xsp-1.2.5
> > /src/Mono.WebServer/XSPWebSource.cs:105
> >   at Mono.WebServer.ApplicationServer.StartRequest (
> > System.Net.Sockets.Socket,int) [0x00002] in /src/xsp-1.2.5
> > /src/Mono.WebServer/ApplicationServer.cs:348
> >   at Mono.WebServer.ApplicationServer.ReuseSocket (
> > System.Net.Sockets.Socket,int) [0x00000] in /src/xsp-1.2.5/src/Mono.WebServer/ApplicationServer.cs:361
> >
> >   at (wrapper remoting-invoke-with-check)
> > Mono.WebServer.ApplicationServer.ReuseSocket (System.Net.Sockets.Socket,int)
> > <0xffffffff>
> >   at Mono.WebServer.XSPWorker.Close (bool) [0x00097] in /src/xsp-1.2.5/src/Mono.WebServer/XSPWorker.cs:236
> >
> >   at Mono.WebServer.XSPRequestBroker.Close (int,bool) [0x00014] in
> > /src/xsp-1.2.5/src/Mono.WebServer/XSPRequestBroker.cs:66
> >   at (wrapper remoting-invoke-with-check)
> > Mono.WebServer.XSPRequestBroker.Close (int,bool) <0xffffffff>
> >   at (wrapper xdomain-dispatch) Mono.WebServer.XSPRequestBroker.Close(object,byte[]&,byte[]&,int,bool) <0xffffffff>
> > Segmentation fault
> >
> >
> > I then ran the same command line and attached to the process using gdb:
> >
> > root at ruski:/var/www/web4/web# gdb mono 9371
> > GNU gdb 6.4.90-debian
> > Copyright (C) 2006 Free Software Foundation, Inc.
> > GDB is free software, covered by the GNU General Public License, and you
> > are
> > welcome to change it and/or distribute copies of it under certain
> > conditions.
> > Type "show copying" to see the conditions.
> > There is absolutely no warranty for GDB.  Type "show warranty" for
> > details.
> > This GDB was configured as "i486-linux-gnu"...Using host libthread_db
> > library "/lib/libthread_db.so.1".
> >
> > Attaching to program: /usr/local/bin/mono, process 9371
> > Reading symbols from /usr/lib/libgthread-2.0.so.0...done.
> > Loaded symbols for /usr/lib/libgthread-2.0.so.0
> > Reading symbols from /usr/lib/libglib-2.0.so.0...done .
> > Loaded symbols for /usr/lib/libglib-2.0.so.0
> > Reading symbols from /lib/librt.so.1...done.
> > Loaded symbols for /lib/librt.so.1
> > Reading symbols from /lib/libdl.so.2...done.
> > Loaded symbols for /lib/libdl.so.2
> > Reading symbols from /lib/libpthread.so.0...done.
> > [Thread debugging using libthread_db enabled]
> > [New Thread -1210198336 (LWP 9371)]
> > [New Thread -1231938640 (LWP 9390)]
> > [New Thread -1220764752 (LWP 9379)]
> > [New Thread -1220682832 (LWP 9378)]
> > Loaded symbols for /lib/libpthread.so.0
> > Reading symbols from /lib/libm.so.6...done.
> > Loaded symbols for /lib/libm.so.6
> > Reading symbols from /lib/libc.so.6...done.
> > Loaded symbols for /lib/libc.so.6
> > Reading symbols from /lib/ld-linux.so.2...done.
> > Loaded symbols for /lib/ld-linux.so.2
> > Reading symbols from /usr/local/lib/libmono-
> > profiler-heap-buddy.so...done.
> > Loaded symbols for /usr/local/lib/libmono-profiler-heap-buddy.so
> > Reading symbols from /usr/local/lib/libmono.so.0...done.
> > Loaded symbols for /usr/local/lib/libmono.so.0
> > Reading symbols from /lib/libnss_compat.so.2...done.
> > Loaded symbols for /lib/libnss_compat.so.2
> > Reading symbols from /lib/libnsl.so.1...done.
> > Loaded symbols for /lib/libnsl.so.1
> > Reading symbols from /lib/libnss_nis.so.2...done.
> > Loaded symbols for /lib/libnss_nis.so.2
> > Reading symbols from /lib/libnss_files.so.2...done.
> > Loaded symbols for /lib/libnss_files.so.2
> > Reading symbols from /lib/libgcc_s.so.1...done.
> > Loaded symbols for /lib/libgcc_s.so.1
> > 0xb7f2ec41 in __read_nocancel () from /lib/libpthread.so.0
> > (gdb) bt
> > #0  0xb7f2ec41 in __read_nocancel () from /lib/libpthread.so.0
> > #1  0x081148ca in console_read (handle=0x0, buffer=0xc2ab0,
> > numbytes=1024,
> >     bytesread=0xbfffd3ec, overlapped=0x0) at io.c:1069
> > #2  0x08115bed in ReadFile (handle=0x0, buffer=0xc2ab0, numbytes=1024,
> >     bytesread=0xbfffd3ec, overlapped=0x0) at io.c:2179
> > #3  0x0817ed26 in ves_icall_System_IO_MonoIO_Read (handle=0x0,
> > dest=0xc2aa0,
> >     dest_offset=0, count=797360, error=0xbfffd45c) at file-io.c:605
> > #4  0xb6aa4293 in ?? ()
> > #5  0x00000000 in ?? ()
> > (gdb) continue
> > Continuing.
> > Could not open /proc/12054/status
> > (gdb) continue
> > Continuing.
> > Could not open /proc/12054/status
> > (gdb)
> >
> > as you can see, I'm unable to continue the process and thus cannot cause
> > the errant behavour.
> >
> > Any further ideas?
> >
> > Russell
> >
> > On Dec 6, 2007 1:14 PM, Rodrigo Kumpera <kumpera at gmail.com> wrote:
> >
> > > Russel,
> > >
> > > Send the whole stack trace, including the native ones. In case it's
> > > not appearing, run xsp under debug and get it from gdb (use "bt" when the
> > > gdb console appears).
> > >
> > >
> > > Rodrigo
> > >
> > >
> > > On Dec 6, 2007 5:38 AM, Russell <rusvdw at gmail.com> wrote:
> > >
> > > > XSP2 now dies with a segmentation fault while serving the page:
> > > >
> > > > root at ruski:/var/www/web4/web# mono --profile=heap-buddy:heap.log/usr/local/lib/mono/2.0/xsp2.exe
> > > > *** Running with heap-buddy ***
> > > > xsp2
> > > > Listening on port: 8080 (non-secure)
> > > > Listening on address: 0.0.0.0
> > > > Root directory: /var/www/web4/web
> > > > Hit Return to stop the server.
> > > > Stacktrace:
> > > >
> > > >   at (wrapper managed-to-native)
> > > > System.Object.__icall_wrapper_mono_array_new_specific (intptr,int)
> > > > <0x00004>
> > > >   at (wrapper managed-to-native)
> > > > System.Object.__icall_wrapper_mono_array_new_specific (intptr,int)
> > > > <0xffffffff>
> > > >   at Mono.WebServer.LingeringNetworkStream.LingeringClose ()
> > > > <0x000e6>
> > > >   at Mono.WebServer.LingeringNetworkStream.Close () <0x00018>
> > > >   at Mono.WebServer.XSPWorker.Close (bool) <0x0003f>
> > > >   at Mono.WebServer.XSPRequestBroker.Close (int,bool) <0x00046>
> > > >   at (wrapper remoting-invoke-with-check)
> > > > Mono.WebServer.XSPRequestBroker.Close (int,bool) <0xffffffff>
> > > >   at (wrapper xdomain-dispatch)
> > > > Mono.WebServer.XSPRequestBroker.Close(object,byte[]&,byte[]&,int,bool) <0xffffffff>
> > > > Segmentation fault
> > > >
> > > > Any further ideas?
> > > >
> > > > ps. heap-shot isn't an option as I'm on an GUI-less server. I can't
> > > > compile it either due to it's GUI dependencies.
> > > >
> > > >
> > > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20071211/ffbd65c8/attachment-0001.html 


More information about the Mono-list mailing list