|
From: Leif M. <le...@ta...> - 2003-04-15 16:30:08
|
Andy,
After looking over the code for about 3 hours tonight, all I can say is
that is
very strange!!! :-/
I have not been able to figure out how free could be getting called more
than
once for those variables. They are being set to NULL immediately after
being
freed. Also that exact code has been working perfectly for well over a
year
on all the other UNIX platforms.
I thought that I had maybe screwed up the ifdefs someplace but they all look
fine.
I went through and fixed the code in a few places where I was not setting
variables to NULL after they were freed, but none of them looked like they
could have caused any problems. You may want to try again with these
changes but I would be surprised if they made any difference.
The OSX machine on the SF compile farm has not yet come back so I am
not able to try this out myself. If there are any other MAC OSX users out
there who would be interested in helping out with this I would
appreciate it.
For now I am out of ideas. It doesn't make sense why there would be
problems like this on one UNIX platform when all other platforms are
working correctly. But as is clearly shown in your logs below, you are
indeed having this problem :-P
As an experiment, I tried calling free twice in that code to see what
happens
and it immediately seg faults on Linux. So that makes me doubt that there
is a problem in the Linux version that is just hiding...
Sorry. Not a very useful reply...
Leif :-/
Andy Barnett wrote:
> Leif,
>
> Regarding the SegFaults I was seeing, they were accompanied by this
> cryptic console output:
>
>> Thread 0 Crashed:
>> #0 0x9000434c in free_list_add_ptr
>> #1 0x90003fe8 in szone_free
>> #2 0x00004e28 in wrapperBuildJavaCommand
>> #3 0x00003630 in wrapperEventLoop
>> #4 0x000049e4 in wrapperRunConsole
>> #5 0x0000591c in main
>> #6 0x000018d8 in _start (crt.c:267)
>> #7 0x00001758 in start
>
>
> Which I used to track down to the wrapperBuildJavaCommand function in
> the wrapper_unix.c file. With a little trial & error, I ended up
> making this change to that function (note my 2 new printf's):
>
>> while(wrapperData->jvmCommand[i] != NULL) {
>> printf("before free [%d]\n", i);
>> free(wrapperData->jvmCommand[i]);
>> printf("after free [%d]\n", i);
>> wrapperData->jvmCommand[i] = NULL;
>> i++;
>> }
>
>
> Then when I executed "cd bin; ./testwrapper console", I saw this output:
>
>> wrapper | --> Wrapper Started as Console
>> wrapper | Launching a JVM...
>> jvm 1 | Initializing...
>> jvm 1 | Wrapper (Version 3.0.3)
>> jvm 1 |
>> jvm 1 | start()
>> wrapper | JVM exited unexpectedly.
>> before free [0]
>> after free [0]
>> before free [1]
>> after free [1]
>> before free [2]
>> after free [2]
>> before free [3]
>> after free [3]
>> before free [4]
>> after free [4]
>> before free [5]
>> after free [5]
>> before free [6]
>> after free [6]
>> before free [7]
>> after free [7]
>> before free [8]
>> after free [8]
>> before free [9]
>> after free [9]
>> before free [10]
>> after free [10]
>> before free [11]
>> *** malloc[1553]: Deallocation of a pointer not malloced: 0xc000;
>> This could be a double free(), or free() called with the middle of an
>> allocated block; Try setting environment variable MallocHelp to see
>> tools to help debug
>> after free [11]
>> before free [12]
>> *** malloc[1553]: Deallocation of a pointer not malloced: 0x357b;
>> This could be a double free(), or free() called with the middle of an
>> allocated block; Try setting environment variable MallocHelp to see
>> tools to help debug
>> after free [12]
>> wrapper | Launching a JVM...
>> jvm 2 | Initializing...
>> jvm 2 | Wrapper (Version 3.0.3)
>> jvm 2 |
>> jvm 2 | start()
>> jvm 2 | stop(0)
>> wrapper | <-- Wrapper Stopped
>
>
> Note: the first "JVM exited unexpectedly" was due to clicking the
> "halt(0)" button in the GUI, and the final "stop(0)" was due to
> clicking the "exit" button.
>
> So it appears that the last two indexed values in the jvmCommand,
> while not NULL, are already freed once and this code is free'ing a 2nd
> time.
>
> What are your thoughts on this?
> ~Andy
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Wrapper-user mailing list
> Wra...@li...
> https://lists.sourceforge.net/lists/listinfo/wrapper-user
>
|