| Ticket UUID: | 2973361 | ||
| Title: | mem corrupt troubles, [try] ? | ||
| Type: | Bug | Created on: | 2010-03-19 17:50:41 |
| Submitter: | dgp | Assigned to: | dgp |
| Subsystem: | 47. Bytecode Compiler | Severity: | |
| Priority: | 5 Medium | Last modified: | 2010-03-23 05:46:04 |
| Status: | Closed | Closed by: | dgp |
| Resolution: | Fixed | Closed on: | 2010-03-22 22:46:04 |
| Version: | obsolete: 8.6b1.1 | ||
| Description: | ||||
Not really good with valgrind, but I think this points to real trouble, and suspect it may relate to intermittent segfaults I see in set-old.test: From a `make valgrind` run on default unix HEAD build: autoMkindex.test ==15475== Invalid read of size 4 ==15475== at 0x8119F90: TclInitCompileEnv (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x811A6E7: TclSetByteCodeFromAny (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x811A8B3: SetByteCodeFromAny (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x812E6CB: TclCompileObj (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x80DAA58: TclNREvalObjEx (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x80F422D: TryPostBody (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x80D465E: TclNRRunCallbacks (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x812EC2C: TclExecuteByteCode (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== Address 0x44B99C4 is 4 bytes before a block of size 40 alloc'd ==15475== at 0x40053C0: malloc (vg_replace_malloc.c:149) ==15475== by 0x8155E5C: TclpAlloc (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x80DEED4: Tcl_Alloc (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x8117ED9: TclCompileScript (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x811A726: TclSetByteCodeFromAny (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x811A8B3: SetByteCodeFromAny (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x812E6CB: TclCompileObj (in /home/dgp/cvs/tcl-only/unix/tcltest) ==15475== by 0x80DAA58: TclNREvalObjEx (in /home/dgp/cvs/tcl-only/unix/tcltest) Will continue to chase, but wanted the data in front of other eyeballs too which might have greater reading skill. | ||||
| User Comments: | ||||
dgp added on 2010-03-20 01:22:41:
With some chat help (thanks miguel!) here's a more useful picture: autoMkindex.test ==20100== Invalid read of size 4 ==20100== at 0x8147245: TclInitCompileEnv (tclCompile.c:1206) ==20100== by 0x81465E1: TclSetByteCodeFromAny (tclCompile.c:549) ==20100== by 0x81467ED: SetByteCodeFromAny (tclCompile.c:660) ==20100== by 0x81639CB: TclCompileObj (tclExecute.c:1721) ==20100== by 0x80F3421: TclNREvalObjEx (tclBasic.c:6030) ==20100== by 0x8115225: TryPostBody (tclCmdMZ.c:4489) ==20100== by 0x80F0D4D: TclNRRunCallbacks (tclBasic.c:4294) ==20100== by 0x817649C: TclExecuteByteCode (tclExecute.c:7983) ==20100== Address 0x48F4F4C is 4 bytes before a block of size 40 alloc'd ==20100== at 0x40053C0: malloc (vg_replace_malloc.c:149) ==20100== by 0x8196128: TclpAlloc (tclAlloc.c:708) ==20100== by 0x80FBD30: Tcl_Alloc (tclCkalloc.c:1044) ==20100== by 0x814B273: EnterCmdWordData (tclCompile.c:2874) ==20100== by 0x8147B46: TclCompileScript (tclCompile.c:1586) ==20100== by 0x8146635: TclSetByteCodeFromAny (tclCompile.c:571) ==20100== by 0x81467ED: SetByteCodeFromAny (tclCompile.c:660) ==20100== by 0x81639CB: TclCompileObj (tclExecute.c:1721) dgp added on 2010-03-20 01:42:18:
dgpthe 2010-02-09 commit makes this particular failure happen in this particular place dgp(add compiler for [try]) dgpI suspect that flaw is actually older and deeper and the 2010-02-09 commit just moved it to where it's easier to notice dgp added on 2010-03-22 04:52:32:
when trouble arises, word == -1 dgp added on 2010-03-22 04:54:03:
tracks back to iPtr->invokeWord == -1. dgp added on 2010-03-22 04:57:18:
...which is just a temporary sneaky storage slot for the value passed in by TryPostBody. dgp added on 2010-03-22 05:01:30:
dkf, what are you trying to signal by passing in the -1 values? Do you really mean to pass in INT_MIN ? dkf added on 2010-03-22 08:13:18:
IIRC, it's trying to say "don't know which argument this was" because at that point I genuinely don't know which arg it was. If you want to figure that out and add it in, be my guest. dgp added on 2010-03-22 11:38:05:
Well, the "-1" values are undoubtedly the wrong thing to pass in. They are just causing attempts to read to the memory below the array in memory, which makes valgrind burp. INT_MAX appears to be a "don't know" or "don't attempt to use me" value that appears elsewhere. Assigning to the TIP 280 master for confirmation. I agree that ultimately it would be nicer to just compute the right values and pass them in. TclArgumentGet() appears to be a utility that may help with that. In the more immediate term, though, I just want to stop doing something broken. Unless aku objects, I think a -1 -> INT_MIN revision is a step in the right direction. andreas_kupries added on 2010-03-23 02:16:59:
Ok, found the place. tclBasic.c, line 5970ff seems to be where INT_MIN is checked for. The relevant ChangeLog entries seem to be 2008-06-08 and 2008-07-29 andreas_kupries added on 2010-03-23 02:21:39:
Giving this back to dgp, he seems to be goign for the proper fix, i.e. determining the actual indices of the relevant words. [11:55]dgpINT_MIN [11:56]dgpsee Tcl_NREvalObj() [12:00]akudgp - Thanks. tclBasic, line 8206 ... Now I am confused. INT_MIN is < 0, and is the 'word' in TclInitCompileEnv ... nline cannot be <= and the condition should not short. IOW, with INT_MIN I do not see how this works. [12:00]akuAh, now I see [12:01]dgpdon't sweat it; I'm closing on the final fix [12:01]akutclBasic line 5970, that makes the explicit check for INT_MIN [12:01]akuok dgp added on 2010-03-23 05:46:04:
allow_comments - 1 fix committed. | ||||
