in reply to Re^3: threads->new falling in a heap.
in thread threads->new falling in a heap.

Add to that the fault I'm chasing is inetermittant so probably less than that!

Except that it's only just started.

I guess maybe Komodo is using something that is not thread-safe under 11.10 - I'd still love to know what it is.

Regards

Steve.

Replies are listed 'Best First'.
Re^5: threads->new falling in a heap.
by BrowserUk (Patriarch) on May 11, 2012 at 14:23 UTC
    Add to that the fault I'm chasing is inetermittant

    From experience, using a debugger is very unlikely to allow you to track down intermittent threading faults anyway. The very act of running code under debugger control inevitably changes the dynamics.

    If you are exceptionally lucky, the change will make the problem occur more frequently and reliably, but in 20+ years of working with threaded code that happened exactly once. On every other occasion, even semi-reliable bugs would fail to manifest themselves at all under the debugger and reappear as soon as it was taken out of the picture.

    In my experience, the first thing to do with intermediate bugs is make them reproducible. That means running the code in a controlled (repeatable) way in a production-like environment until the problem is reliably reproducible.

    The next thing to do, is track down what is going on, and where, when the problem occurs. And that always means adding wide-spread, low-granularity, low-overhead logging.

    • Wide-spread means in all threads and functions.

      Don't make the mistake of guessing where the problem might be and concentrating there. You're usually wrong!

    • Low granularity means don't try and log everything.

      There is no point in logging huge volumes of unrelated details. It just gives more crap to wade through and more importantly, can change the dynamics. That can cause the problem to move or disappear completely.

    • Low overhead means avoid anything that might cause memory allocation or CRT locks to be used.

      For example, printf (the C version) will usually need to allocate some temporary space for the formatting. That can cause your bug to 'move'.

      Equally, threadsafe-CRTs often employ internal locking when performing IO (writing to files etc.). Again, that can cause the bug to move or disappear entirely -- until the logging is removed!

    Often the best logging mechanism is a very simple, unformatted output (ex.just the current thread and line number) using the UDP sendto() function to a local port. On the other end of that port you have a program that simply listens to the port and logs the data to disk (preferably one not used by the monitored program; a USB thumb-drive is ideal!), in a tight loop with no attempt at interpreting it.

    This logging can be added to the code at (say) the entry and exit points of the major functions, with little or no impact on the performance or dynamics of the code being monitored. Once the error occurs, you can inspect that log to work out where each thread was when it occurred. You can then remove most of the logging and increase the granularity within those functions active when the bug manifests. Re-run and gradually 'zoom in' on the specific circumstances that cause the bug to arise.

    It may sound somewhat crude and slow, but with a little practice (and some well-crafted macros if you are using C), it is very effective. Once you know where each thread is (and therefore what it is doing) when the bug occurs, it is usually obvious where the problem lies.

    If your code is not proprietary, I'd be willing to take a look. No promises -- I probably couldn't run it here -- but I might spot something.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Hi BrowserUK,

      First of all let me thank you for you very kind offer of looking at the code.

      In fact, I have isolated the problem using the steps you suggest. What I thought was an intermittant fault is now 100% reproduceable and understood. Really it could be classified as a 'design' problem. While playing a live-streamed video which is being recorded at the same time, if I pause and take a snap of the position, the background process runs off and takes the snap (using the afore-mentioned 'threads'). Because the snap is from the end of the file the frame has not been written completely to the file. If I subtract 1 frame from the position it works fine - but a lot can happen in a frame and it's not an ideal solution. Alternatively, and this is what I will do for the time being, I can disable the snap button. The correct answer is to buffer the command until play has resumed or alternatively stopped altogether and the final frame of the video is written to the file and the file is closed.

      If the video is not paused, then also the frame has been written by the time 'threads' gets to it and also, all is fine.

      However I am left feeling that my IDE which works fine most of the time, has a blind-spot and resolving issues in this blind spot is much more time-consuming than I would like.

      Thank you again for your support.

      Regards

      Steve

        However I am left feeling that my IDE which works fine most of the time, has a blind-spot ...

        I installed a trial copy of Komodo and started it. Even before I loaded any files, it was already running 32 kernel threads to just sit there doing nothing.

        And whilst I cannot be certain, it looks like at least one of those threads and possibly more could be a Java "green threads" scheduler.

        I loaded a (single) perl file and that increased to 43 threads.

        Then I took a look at the dll's it loads:

        Process: komodo.exe Pid: 4904 Name Description Company Name Version _ctypes.pyd _hashlib.pyd _SilverCity.pyd _socket.pyd _sqlite3.pyd _ssl.pyd _win32sysloader.pyd _xpcom.pyd AcGenral.DLL Windows Compatibility DLL Microsoft Corporation +6.0.6001.18000 actxprxy.dll ActiveX Interface Marshaling Library Microsoft Corp +oration 6.0.6001.18000 ADVAPI32.dll Advanced Windows 32 Base API Microsoft Corporation + 6.0.6001.18000 apphelp.dll Application Compatibility Client Library Microsoft C +orporation 6.0.6001.18000 audioeng.dll Audio Engine Microsoft Corporation 6.0.6001.1800 +0 AUDIOSES.DLL Audio Session Microsoft Corporation 6.0.6001.180 +00 AVRT.dll Multimedia Realtime Runtime Microsoft Corporation 6. +0.6001.18000 browseui.dll Shell Browser UI Library Microsoft Corporation 6 +.0.6001.18000 browseui.dll.mui Shell Browser UI Library Microsoft Corporation + 6.0.6000.16386 cElementTree.pyd ciElementTree.pyd CLBCatQ.DLL COM+ Configuration Catalog Microsoft Corporation +2001.12.6931.18000 comctl32.dll User Experience Controls Library Microsoft Corporat +ion 6.10.6001.18523 COMDLG32.dll Common Dialogs DLL Microsoft Corporation 6.0.600 +1.18000 comdlg32.dll.mui Common Dialogs DLL Microsoft Corporation 6.0 +.6000.16386 cookies.sqlite-shm CRYPT32.dll Crypto API32 Microsoft Corporation 6.0.6001.18000 cscapi.dll Offline Files Win32 API Microsoft Corporation 6.0. +6001.18000 dbexplorer.jar dbghelp.dll Windows Image Helper Microsoft Corporation 6.0.60 +01.18000 dhcpcsvc.DLL DHCP Client Service Microsoft Corporation 6.0.60 +01.18000 dhcpcsvc6.DLL DHCPv6 Client Microsoft Corporation 6.0.6001.18 +000 DNSAPI.dll DNS Client API DLL Microsoft Corporation 6.0.6001. +18611 domviewer.jar DUser.dll Windows DirectUser Engine Microsoft Corporation 6.0 +.6001.18000 dwmapi.dll Microsoft Desktop Window Manager API Microsoft Corpor +ation 6.0.6001.18000 en-US.jar fastopen.jar feclient.dll Windows NT File Encryption Client Interfaces Micros +oft Corporation 6.0.6001.18000 freebl3.dll NSS freebl Library Mozilla Foundation 3.12.10.0 fugue.jar GDI32.dll GDI Client DLL Microsoft Corporation 6.0.6001.18159 ieframe.dll Internet Explorer Microsoft Corporation 7.0.6001. +18639 iertutil.dll Run time utility for Internet Explorer Microsoft Co +rporation 7.0.6001.18639 imagehlp.dll Windows NT Image Helper Microsoft Corporation 6. +0.6001.18000 IMM32.DLL Multi-User Windows IMM32 API Client DLL Microsoft Corp +oration 6.0.6001.18000 iphlpapi.dll IP Helper API Microsoft Corporation 6.0.6001.180 +00 kernel32.dll Windows NT BASE API Client DLL Microsoft Corporatio +n 6.0.6001.18215 kernel32.dll.mui Windows NT BASE API Client DLL Microsoft Corpor +ation 6.0.6001.18000 klint.jar koContentUtils.dll koextgen.jar kolicense.dll komob.jar komodo.exe ActiveState Komodo ActiveState 7.0.2.0 komodo.jar komodo_services.jar komodospellchecker.jar koSciDoc.dll koSciMozIMEHelper.dll ksuser.dll User CSA Library Microsoft Corporation 6.0.6000.16 +386 LINKINFO.dll Windows Volume Tracking Microsoft Corporation 6. +0.6000.16386 locale.nls locale.nls LPK.DLL Language Pack Microsoft Corporation 6.0.6001.18000 midimap.dll Microsoft MIDI Mapper Microsoft Corporation 6.0.6 +001.18000 MMDevApi.dll MMDevice API Microsoft Corporation 6.0.6001.1800 +0 MMDevAPI.dll.mui MMDevice API Microsoft Corporation 6.0.6000. +16386 mozalloc.dll Mozilla Foundation 7.0.1.4411 mozjs.dll mozsqlite3.dll SQLite Database Library sqlite.org 3.7.5.0 MPR.dll Multiple Provider Router DLL Microsoft Corporation 6. +0.6001.18000 MSACM32.dll Microsoft ACM Audio Filter Microsoft Corporation +6.0.6001.18000 msacm32.drv Microsoft Sound Mapper Microsoft Corporation 6.0. +6001.18000 MSASN1.dll ASN.1 Runtime APIs Microsoft Corporation 6.0.6001. +18326 mscms.dll Microsoft Color Matching System DLL Microsoft Corporat +ion 6.0.6001.18000 MSCTF.dll MSCTF Server DLL Microsoft Corporation 6.0.6001.180 +00 msctf.dll.mui MSCTF Server DLL Microsoft Corporation 6.0.6000 +.16386 MSIMG32.dll GDIEXT Client DLL Microsoft Corporation 6.0.6000. +16386 msshsq.dll Structured Query Microsoft Corporation 6.0.6001.18 +470 MSVCP90.dll Microsoft® C++ Runtime Library Microsoft Corporation + 9.0.21022.8 MSVCR90.dll Microsoft® C Runtime Library Microsoft Corporation + 9.0.21022.8 msvcrt.dll Windows NT CRT DLL Microsoft Corporation 7.0.6001. +18000 mswsock.dll Microsoft Windows Sockets 2.0 Service Provider Micro +soft Corporation 6.0.6001.18000 napinsp.dll E-mail Naming Shim Provider Microsoft Corporation + 6.0.6001.18000 NETAPI32.dll Net Win32 API DLL Microsoft Corporation 6.0.6001 +.18157 NLAapi.dll Network Location Awareness 2 Microsoft Corporation + 6.0.6001.18000 npscimoz.dll Scintilla Mozilla plugin ActiveState 0.9.1.0 NSI.dll NSI User-mode interface DLL Microsoft Corporation 6.0 +.6001.18000 nspr4.dll NSPR Library Mozilla Foundation 4.8.9.0 nss3.dll NSS Base Library Mozilla Foundation 3.12.10.0 nssckbi.dll NSS Builtin Trusted Root CAs Mozilla Foundation 1 +.87.0.0 nssdbm3.dll Legacy Database Driver Mozilla Foundation 3.12.10 +.0 nssutil3.dll NSS Utility Library Mozilla Foundation 3.12.10.0 ntdll.dll NT Layer DLL Microsoft Corporation 6.0.6001.18538 ntdll.dll NT Layer DLL Microsoft Corporation 6.0.6001.18538 NTDSAPI.dll Active Directory Domain Services API Microsoft Corpo +ration 6.0.6001.18000 NTMARTA.DLL Windows NT MARTA provider Microsoft Corporation 6 +.0.6001.18000 ntshrui.dll Shell extensions for sharing Microsoft Corporation + 6.0.6001.18000 ole32.dll Microsoft OLE for Windows Microsoft Corporation 6.0 +.6001.18498 OLEACC.dll Active Accessibility Core Component Microsoft Corpora +tion 4.2.5406.0 oleaccrc.dll Active Accessibility Resource DLL Microsoft Corpora +tion 4.2.5406.0 OLEAUT32.dll Microsoft Corporation 6.0.6001.18565 perldevkit.jar places.jar places.sqlite-shm plc4.dll PLC Library Mozilla Foundation 4.8.9.0 plds4.dll PLDS Library Mozilla Foundation 4.8.9.0 pnrpnsp.dll PNRP Name Space Provider Microsoft Corporation 6. +0.6001.18000 POWRPROF.dll Power Profile Helper DLL Microsoft Corporation 6 +.0.6001.18000 profiler.jar PROPSYS.dll Microsoft Property System Microsoft Corporation 6 +.0.6001.18000 propsys.dll.mui Microsoft Property System Microsoft Corporation + 6.0.6001.18000 PSAPI.DLL Process Status Helper Microsoft Corporation 6.0.600 +0.16386 publishing.jar pyexpat.pyd pyloader.dll python26.dll Python Core ActiveState Software Inc 2.6.5150.10 +13 pythoncom26.dll pywintypes26.dll pyxpcom.dll railstools.jar rasadhlp.dll Remote Access AutoDial Helper Microsoft Corporation + 6.0.6000.16386 RPCRT4.dll Remote Procedure Call Runtime Microsoft Corporation + 6.0.6001.18247 rsaenh.dll Microsoft Enhanced Cryptographic Provider Microsoft C +orporation 6.0.6001.18000 SAMLIB.dll SAM Library DLL Microsoft Corporation 6.0.6001.180 +00 SciLexer.dll Scintilla.DLL - a Source Editing Component Neil Hod +gson neilh@scintilla.org 2.2.8.0 Secur32.dll Security Support Provider Interface Microsoft Corpor +ation 6.0.6001.18272 select.pyd SETUPAPI.dll Windows Setup API Microsoft Corporation 6.0.6001 +.18000 setupapi.dll.mui Windows Setup API Microsoft Corporation 6.0. +6001.18000 sfc.dll Windows File Protection Microsoft Corporation 6.0.600 +0.16386 sfc_os.DLL Windows File Protection Microsoft Corporation 6.0. +6001.18000 sgmlop.pyd SHDOCVW.dll Shell Doc Object and Control Library Microsoft Corpo +ration 6.0.6001.18000 shdocvw.dll.mui Shell Doc Object and Control Library Microsoft C +orporation 6.0.6000.16386 shell.pyd SHELL32.dll Windows Shell Common Dll Microsoft Corporation 6. +0.6001.18588 shell32.dll.mui Windows Shell Common Dll Microsoft Corporation + 6.0.6001.18000 ShimEng.dll Shim Engine DLL Microsoft Corporation 6.0.6000.16 +386 SHLWAPI.dll Shell Light-weight Utility Library Microsoft Corpora +tion 6.0.6001.18588 silkicons.jar slc.dll Software Licensing Client Dll Microsoft Corporation 6 +.0.6001.18000 smime3.dll NSS S/MIME Library Mozilla Foundation 3.12.10.0 softokn3.dll NSS PKCS #11 Library Mozilla Foundation 3.12.10. +0 sqlite3.dll ssl3.dll NSS SSL Library Mozilla Foundation 3.12.10.0 stackatotools.jar startupCache.4.little sync.jar t2embed.dll Microsoft T2Embed Font Embedding Microsoft Corporati +on 6.0.6001.18520 tcldevkit.jar thumbcache.dll Microsoft Thumbnail Cache Microsoft Corporation + 6.0.6001.18000 toolkit.jar urlmon.dll OLE32 Extensions for Win32 Microsoft Corporation 7 +.0.6001.18639 USER32.dll Multi-User Windows USER API Client DLL Microsoft Corp +oration 6.0.6001.18000 user32.dll.mui Multi-User Windows USER API Client DLL Microsoft +Corporation 6.0.6001.18000 USERENV.dll Userenv Microsoft Corporation 6.0.6001.18000 USP10.dll Uniscribe Unicode script processor Microsoft Corporati +on 1.626.6001.18461 UxTheme.dll Microsoft UxTheme Library Microsoft Corporation 6 +.0.6001.18000 VERSION.dll Version Checking and File Installation Libraries Mic +rosoft Corporation 6.0.6001.18000 wdmaud.drv Winmm audio system driver Microsoft Corporation 6 +.0.6001.18000 wdmaud.drv.mui Winmm audio system driver Microsoft Corporation + 6.0.6000.16386 win32api.pyd WindowsCodecs.dll Microsoft Windows Codecs Library Microsoft Cor +poration 6.0.6001.18000 WINMM.dll MCI API DLL Microsoft Corporation 6.0.6001.18000 winmm.dll.mui MCI API DLL Microsoft Corporation 6.0.6000.1638 +6 WINNSI.DLL Network Store Information RPC interface Microsoft Cor +poration 6.0.6001.18000 winrnr.dll LDAP RnR Provider DLL Microsoft Corporation 6.0.60 +00.16386 WINSPOOL.DRV Windows Spooler Driver Microsoft Corporation 6.0 +.6001.18000 WINTRUST.dll Microsoft Trust Verification APIs Microsoft Corpora +tion 6.0.6001.18387 WLDAP32.dll Win32 LDAP API DLL Microsoft Corporation 6.0.6001 +.18000 wow64.dll Win32 Emulation on NT64 Microsoft Corporation 6.0.6 +001.18000 wow64cpu.dll AMD64 Wow64 CPU Microsoft Corporation 6.0.6001. +18000 wow64win.dll Wow64 Console and Win32 API Logging Microsoft Corpo +ration 6.0.6001.18000 WS2_32.dll Windows Socket 2.0 32-Bit DLL Microsoft Corporation + 6.0.6001.18000 wship6.dll Winsock2 Helper DLL (TL/IPv6) Microsoft Corporation + 6.0.6001.18000 wshtcpip.dll Winsock2 Helper DLL (TL/IPv4) Microsoft Corporation + 6.0.6001.18000 WSOCK32.dll Windows Socket 32-Bit DLL Microsoft Corporation 6 +.0.6001.18000 xpcom.dll Mozilla Foundation 7.0.1.4411 xtk.jar xul.dll Mozilla Foundation 7.0.1.4411 zendframework.jar

        C-runtime. C++ Runtime, Python runtime, Java-runtime, perl development kit, XUL, OLE, .NET, Active Directory, ActiveX, LDAP; audio drivers, Multimedia drivers, Internet Explorer runtime, 3 different graphics frameworks, 3 different encryption libraries, Remote access dialer, Remote procedure calls; DNS, DHCP, every sockets library known to man; sqlite, MSSQL; ???

        Good grief. Are they trying to compete with EMACS in the operating-system-disguised-as-an-editor Olympiad?

        Frankly, I don't know whether to condemn the authors or just stand with my mouth open and slow hand-clap them in sheer amazement.

        Anyway, glad you solved your problem :)


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?