problem with threads in tclExecute.c ...
Closed / Invalid1839297fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-11-27 09:30:58
Hi, I'm currently making a client-server application suite to control test-hardware in python 2.4.3 build 12 using threads (one for every server the client connect to, while the server uses one thread for every test it commands) and tkinter (for client GUI). The server seems to work just fine, the client application however crashes sometimes when it should update the GUI. If this would have been due to a fault in my python code the python interpreter would have terminated the program and dump a trace and description to the terminal, but in this case the would interpreter crashes with Windows XP (Swedish) telling me that it caused a Access Violation in tcl84.dll (not quite sure exact which TCL version exept 8.4.x). After some debugging in mainly Ollydbg32 I found out that the fault is probally happening in generic/tclExecute.c and the macro "cleanupV_pushObjResultPtr" which is included in the tcl bytecode interpreter under the bytecode INST_LSET_FLAT. (See below for ASM code from OllyDbg32, 0x1002EE67 is the addr where my program crashes). Also, one thing that's weird is that the thread that ran this code (I have a couple of threads in the process, were as 1 is directly created by my app) has a empty call stack and was created right before it crashed so I looks as thou tcl created a bogus thread. The reason why I'm asking here is because I havn't read much about "this" bug on Internet (or anywhere else for the matter). Is this bug fixed in python 2.5, like if I move my code to 2.5 it will go away or is this something new? Let me know if anybody needs more info or anything... Thanks! 1002EDC7 . 3B05 B04C0810 CMP EAX,DWORD PTR DS:[10084CB0] ; tcl84.10089F98 1002EDCD . 74 09 JE SHORT tcl84.1002EDD8 1002EDCF . 50 PUSH EAX 1002EDD0 . E8 1B24FEFF CALL tcl84.Tcl_Free 1002EDD5 . 83C4 04 ADD ESP,4 1002EDD8 > 8B15 949F0810 MOV EDX,DWORD PTR DS:[10089F94] 1002EDDE . 8957 10 MOV DWORD PTR DS:[EDI+10],EDX 1002EDE1 . 893D 949F0810 MOV DWORD PTR DS:[10089F94],EDI 1002EDE7 > 8B4C24 18 MOV ECX,DWORD PTR SS:[ESP+18] 1002EDEB . 8B04B1 MOV EAX,DWORD PTR DS:[ECX+ESI*4] 1002EDEE . 50 PUSH EAX 1002EDEF . 894424 24 MOV DWORD PTR SS:[ESP+24],EAX 1002EDF3 . 8B4424 4C MOV EAX,DWORD PTR SS:[ESP+4C] 1002EDF7 . 8BD6 MOV EDX,ESI 1002EDF9 . 2BD0 SUB EDX,EAX 1002EDFB . 8D0C91 LEA ECX,DWORD PTR DS:[ECX+EDX*4] 1002EDFE . 8B55 08 MOV EDX,DWORD PTR SS:[EBP+8] 1002EE01 . 51 PUSH ECX 1002EE02 . 50 PUSH EAX 1002EE03 . 57 PUSH EDI 1002EE04 . 52 PUSH EDX 1002EE05 . E8 C6730100 CALL tcl84.TclLsetFlat 1002EE0A . 8BD8 MOV EBX,EAX 1002EE0C . 83C4 14 ADD ESP,14 1002EE0F . 85DB TEST EBX,EBX 1002EE11 . 75 0D JNZ SHORT tcl84.1002EE20 1002EE13 . C74424 34 0100>MOV DWORD PTR SS:[ESP+34],1 1002EE1B .^E9 FBFCFFFF JMP tcl84.1002EB1B 1002EE20 > 834424 0C 05 ADD DWORD PTR SS:[ESP+C],5 1002EE25 . 8B4424 48 MOV EAX,DWORD PTR SS:[ESP+48] 1002EE29 . 40 INC EAX 1002EE2A > 894424 14 MOV DWORD PTR SS:[ESP+14],EAX 1002EE2E > 8B7C24 0C MOV EDI,DWORD PTR SS:[ESP+C] 1002EE32 > 8B4424 14 MOV EAX,DWORD PTR SS:[ESP+14] 1002EE36 . 83E8 00 SUB EAX,0 ; Switch (cases 0..2) 1002EE39 . 74 7D JE SHORT tcl84.1002EEB8 1002EE3B . 48 DEC EAX 1002EE3C . 0F84 19110000 JE tcl84.1002FF5B 1002EE42 . 48 DEC EAX 1002EE43 . 0F84 B1100000 JE tcl84.1002FEFA 1002EE49 . 8B4424 14 MOV EAX,DWORD PTR SS:[ESP+14] ; Default case of switch 1002EE36 1002EE4D . 83E8 02 SUB EAX,2 1002EE50 . 894424 14 MOV DWORD PTR SS:[ESP+14],EAX 1002EE54 . 0F84 A0100000 JE tcl84.1002FEFA 1002EE5A . 8BC8 MOV ECX,EAX 1002EE5C . 894C24 48 MOV DWORD PTR SS:[ESP+48],ECX 1002EE60 > 8B5424 18 MOV EDX,DWORD PTR SS:[ESP+18] 1002EE64 . 8B3CB2 MOV EDI,DWORD PTR DS:[EDX+ESI*4] 1002EE67 . 8B0F MOV ECX,DWORD PTR DS:[EDI]<----- THE CLIENT CRASHES HERE! 1002EE69 . 4E DEC ESI 1002EE6A . 49 DEC ECX 1002EE6B . 8BC1 MOV EAX,ECX 1002EE6D . 85C0 TEST EAX,EAX 1002EE6F . 890F MOV DWORD PTR DS:[EDI],ECX 1002EE71 . 7F 3A JG SHORT tcl84.1002EEAD 1002EE73 . 8B47 0C MOV EAX,DWORD PTR DS:[EDI+C] 1002EE76 . 85C0 TEST EAX,EAX 1002EE78 . 74 0D JE SHORT tcl84.1002EE87 1002EE7A . 8B40 04 MOV EAX,DWORD PTR DS:[EAX+4] 1002EE7D . 85C0 TEST EAX,EAX 1002EE7F . 74 06 JE SHORT tcl84.1002EE87 1002EE81 . 57 PUSH EDI 1002EE82 . FFD0 CALL EAX 1002EE84 . 83C4 04 ADD ESP,4 1002EE87 > 8B47 04 MOV EAX,DWORD PTR DS:[EDI+4] 1002EE8A . 85C0 TEST EAX,EAX 1002EE8C . 74 11 JE SHORT tcl84.1002EE9F 1002EE8E . 3B05 B04C0810 CMP EAX,DWORD PTR DS:[10084CB0] ; tcl84.10089F98
msoferplain2007-11-27 17:15:50
Logged In: YES user_id=148712 Originator: NO It certainly looks like pilot error from here - specifically, Tcl_Objs crossing thread boundaries. This would certainly cause this kind of problems on obj deletion, ie, right where you are seeing them. The general rule is that a Tcl interpreter runs in a single thread. Your description is not sufficient to ascertain that this is satisfied here, and the crash raises suspicions that it is not. Are your thread accesses organized as in http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965, for instance? Please insure that your code is not violating these basic Tcl requirements (interps and Tcl_Objs confined to a single thread).
sf-robotplain2007-12-12 10:20:06
Logged In: YES user_id=1312539 Originator: NO This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.