AliSherKashif / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

ConnectionRequest looping with new iOS VM #1362

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The scenario here is very similar to the import problems you have been working 
on, the difference is that instead of reading from a file installed on the 
device, we are reading the same data over the network from a PC application. 
Unfortunately that prevents me from creating a test case.

This is a regression, this function was working with the new iOS VM. Now that 
the file imports seem to be working fine, I can no longer use the network 
connection.

When I run my application on my iPod it seems to run into a problem at the same 
point every time, however the symptoms are different, sometimes it will lock 
up, sometimes it will crash.

Building the generated source code on Xcode, I see the same problem and again 
sometimes it locks up, sometimes it crashes. When it locks up Xcode shows 
memory use is constant and the CPU is running at 5%.

When it crashes it is on the assert in the following method:

void initMethodStack(CODENAME_ONE_THREAD_STATE, JAVA_OBJECT __cn1ThisObject, 
int stackSize, int localsStackSize, int classNameId, int methodNameId) {
#ifdef CN1_INCLUDE_NPE_CHECKS
    if(__cn1ThisObject == JAVA_NULL) {
        THROW_NULL_POINTER_EXCEPTION();
    }
#endif
    memset(&threadStateData->threadObjectStack[threadStateData->threadObjectStackOffset], 0, sizeof(struct elementStruct) * (localsStackSize + stackSize));
    threadStateData->threadObjectStackOffset += localsStackSize + stackSize;
    CODENAME_ONE_ASSERT(threadStateData->callStackOffset < CN1_MAX_STACK_CALL_DEPTH - 1);
    threadStateData->callStackClass[threadStateData->callStackOffset] = classNameId;
    threadStateData->callStackMethod[threadStateData->callStackOffset] = methodNameId;
    threadStateData->callStackOffset++;
}

I have some basic logging built into my app and it shows that we are connecting 
and receive the first few segments of the data, then it either hangs or crashes 
at the         networkManager.addToQueueAndWait(_connectionRequest);

Here is the log from a crash:

2015-02-18 13:30:40.992 AWMain[3323:33647] [null] 0:0:8,514 - SENT: GETROWS
2015-02-18 13:30:41.739 AWMain[3323:33647] [null] 0:0:9,261 - RETURN FROM: 
GETROWS
2015-02-18 13:30:41.740 AWMain[3323:33647] [null] 0:0:9,262 - DATATYPE=text/html
2015-02-18 13:30:41.742 AWMain[3323:33647] [null] 0:0:9,264 - DATALEN=78336
2015-02-18 13:30:41.742 AWMain[3323:33647] [null] 0:0:9,264 - Parsing data
2015-02-18 13:30:41.843 AWMain[3323:33647] [null] 0:0:9,365 - Parsed data
2015-02-18 13:30:41.938 AWMain[3323:33647] [null] 0:0:9,460 - SENT: GETROWS
2015-02-18 13:30:42.278 AWMain[3323:33647] [null] 0:0:9,800 - RETURN FROM: 
GETROWS
2015-02-18 13:30:42.279 AWMain[3323:33647] [null] 0:0:9,801 - DATATYPE=text/html
2015-02-18 13:30:42.280 AWMain[3323:33647] [null] 0:0:9,802 - DATALEN=79384
2015-02-18 13:30:42.281 AWMain[3323:33647] [null] 0:0:9,803 - Parsing data
2015-02-18 13:30:42.378 AWMain[3323:33647] [null] 0:0:9,899 - Parsed data
2015-02-18 13:30:42.462 AWMain[3323:33647] [null] 0:0:9,984 - SENT: GETROWS
2015-02-18 13:30:42.696 AWMain[3323:33647] [null] 0:0:10,218 - RETURN FROM: 
GETROWS
2015-02-18 13:30:42.697 AWMain[3323:33647] [null] 0:0:10,219 - 
DATATYPE=text/html
2015-02-18 13:30:42.698 AWMain[3323:33647] [null] 0:0:10,220 - DATALEN=82062
2015-02-18 13:30:42.699 AWMain[3323:33647] [null] 0:0:10,221 - Parsing data
2015-02-18 13:30:42.813 AWMain[3323:33647] [null] 0:0:10,335 - Parsed data
2015-02-18 13:30:42.903 AWMain[3323:33647] [null] 0:0:10,425 - SENT: GETROWS
2015-02-18 13:30:43.164 AWMain[3323:33647] [null] 0:0:10,686 - RETURN FROM: 
GETROWS
2015-02-18 13:30:43.165 AWMain[3323:33647] [null] 0:0:10,687 - 
DATATYPE=text/html
2015-02-18 13:30:43.166 AWMain[3323:33647] [null] 0:0:10,688 - DATALEN=79459
2015-02-18 13:30:43.167 AWMain[3323:33647] [null] 0:0:10,689 - Parsing data
2015-02-18 13:30:43.265 AWMain[3323:33647] [null] 0:0:10,787 - Parsed data
2015-02-18 13:30:43.367 AWMain[3323:33647] [null] 0:0:10,889 - SENT: GETROWS
2015-02-18 13:30:43.575 AWMain[3323:33647] [null] 0:0:11,97 - RETURN FROM: 
GETROWS
2015-02-18 13:30:43.577 AWMain[3323:33647] [null] 0:0:11,99 - DATATYPE=text/html
2015-02-18 13:30:43.578 AWMain[3323:33647] [null] 0:0:11,100 - DATALEN=80939
2015-02-18 13:30:43.580 AWMain[3323:33647] [null] 0:0:11,102 - Parsing data
2015-02-18 13:30:43.692 AWMain[3323:33647] [null] 0:0:11,214 - Parsed data
2015-02-18 13:30:43.783 AWMain[3323:33647] [null] 0:0:11,305 - SENT: GETROWS
Assertion failed: (threadStateData->callStackOffset < 256 - 1), function 
initMethodStack, file 
/Users/mcw/rware/Projects/AW/dist/AWMain-src/nativeMethods.m, line 955.
(lldb)          

The thread stack in Xcode seems to show a recursive malloc. I have attached 
that as a file as it is rather long.

Hopefully you can see what is going on from this because I don't see how I can 
provide a test case unfortunately.

Original issue reported on code.google.com by mwarn...@readerware.com on 18 Feb 2015 at 9:58

Attachments:

GoogleCodeExporter commented 9 years ago
OK I see the issue. Its from a wrong assumption I made while fixing one of the 
other issues. Its fixed in SVN will try to get it into the servers tomorrow.

Original comment by shai.almog on 21 Feb 2015 at 11:12

GoogleCodeExporter commented 9 years ago
It is working again now.

Thanks

Original comment by mwarn...@readerware.com on 23 Feb 2015 at 7:42