In the past month or so, our Active4D web server has been crashing about once a day. This is not normal. I have a process in place to automatically restart it, but need to fix this. >From looking at web server and crash logs I suspect that we have a memory leak.
(1) This occurs during a time when Active4D is being crawled by our customer's Google Search Appliance. The pages being crawled are Activ4D pages. This pattern is consistent. (2) System error logs indicates that 4D is failing to allocate memory leading up to the crash. 6/18/12 7:20:10 AM 4D[83527] 4D(83527,0xb6689000) malloc: *** mmap(size=16777216) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug 6/18/12 7:20:10 AM [0x0-0x2ae0ade].com.4d.4d[83527] 4D(83527,0xb6689000) malloc: *** mmap(size=16777216) failed (error code=12) 6/18/12 7:20:10 AM [0x0-0x2ae0ade].com.4d.4d[83527] *** error: can't allocate region 6/18/12 7:20:10 AM [0x0-0x2ae0ade].com.4d.4d[83527] *** set a breakpoint in malloc_error_break to debug 6/18/12 7:20:10 AM [0x0-0x2ae0ade].com.4d.4d[83527] terminate called after throwing an instance of 'std::bad_alloc' 6/18/12 7:20:10 AM [0x0-0x2ae0ade].com.4d.4d[83527] what(): std::bad_alloc 6/18/12 7:20:16 AM com.apple.launchd.peruser.506[221] ([0x0-0x2ae0ade].com.4d.4d[83527]) Job appears to have crashed: Abort trap 6/18/12 7:20:17 AM ReportCrash[15089] Saved crash report for 4D[83527] version 11.8 (81344) (81344) to /Users/webclient/Library/Logs/DiagnosticReports/4D_2012-06-18-072017_twpwww.crash (2) The crash occurs in my modified active4D shell when the NTK "TCP_Lookahead_Blob" command is called. Thread 17 Crashed: 0 libSystem.B.dylib 0x93dbe0ee __semwait_signal_nocancel + 10 1 libSystem.B.dylib 0x93dbdfd2 nanosleep$NOCANCEL$UNIX2003 + 166 2 libSystem.B.dylib 0x93e38fb2 usleep$NOCANCEL$UNIX2003 + 61 3 libSystem.B.dylib 0x93e5a6f0 abort + 105 4 libstdc++.6.dylib 0x927c1fda __gnu_cxx::__verbose_terminate_handler() + 433 5 libstdc++.6.dylib 0x927c017a __cxxabiv1::__terminate(void (*)()) + 10 6 libstdc++.6.dylib 0x927c01ba __cxxabiv1::__unexpected(void (*)()) + 0 7 libstdc++.6.dylib 0x927c02b8 __gxx_exception_cleanup(_Unwind_Reason_Code, _Unwind_Exception*) + 0 8 libstdc++.6.dylib 0x927c0658 operator new(unsigned long) + 101 9 libstdc++.6.dylib 0x927c0703 operator new[](unsigned long) + 17 10 com.4D.4DPlugin 0x1eada465 CString::reserve(long) + 67 11 com.4D.4DPlugin 0x1ead81a1 CTCPSocket::receive(CString&, long, bool, char*) + 43 12 com.4D.4DPlugin 0x1ead449c TCP_Lookahead_Blob(PluginBlock*) + 160 13 com.4D.4DPlugin 0x1ead5daa PluginMain + 588 14 com.4D.4DPlugin 0x1eac151d FourDPack + 89 15 com.4d.4d 0x006eb668 0x1000 + 7251560 16 com.4d.4d 0x00151177 0x1000 + 1376631 17 ??? 0x0229df15 0 + 36298517 18 ??? 0x0229bf27 0 + 36290343 19 ??? 0x02214d4d 0 + 35736909 20 com.4d.4d 0x0066311e 0x1000 + 6693150 21 com.4d.4d 0x0014bf77 0x1000 + 1355639 22 com.4d.4d 0x00464fc0 0x1000 + 4603840 23 com.4d.4d 0x0046d9e2 0x1000 + 4639202 24 com.4d.4d 0x0046fac8 0x1000 + 4647624 25 com.4d.4d 0x00472181 0x1000 + 4657537 26 com.4d.4d 0x00449e59 0x1000 + 4492889 27 com.4d.4d 0x003c407a 0x1000 + 3944570 28 com.4d.4d 0x0044a682 0x1000 + 4494978 29 com.4d.4d 0x002f75ad 0x1000 + 3106221 30 com.4d.kernel 0x0175ef1d xbox::VTask::_Run() + 109 31 com.4d.kernel 0x01762e0d xbox::XMacTaskMgr::YieldToFiber(xbox::VTask*) + 253 32 com.4d.kernel 0x017b06e0 SwitchToFiber(void*) + 64 33 ...ple.CoreServices.CarbonCore 0x90b78847 CooperativeThread + 309 34 libSystem.B.dylib 0x93d7e259 _pthread_start + 345 35 libSystem.B.dylib 0x93d7e0de thread_start + 34 My question is what would be the best way to: (a) verify that we have a memory leak, and (b) isolate the cause. I'm thinking that I need to somehow log available memory following each request, then try to figure out where I'm leaking it. 4D's online docs indicate that AP AVAILABLE MEMORY should not be used. Thanks, Brad Perkins _______________________________________________ Active4D-dev mailing list [email protected] http://list.aparajitaworld.com/listinfo/active4d-dev Archives: http://active4d-nabble.aparajitaworld.com/
