[codenameone-discussions] Re: New iOS Crash

2017-01-05 Thread Jérémy MARQUER
Hi ! 
I'm facing a similar issue... 

How can we avoid GC when a connection or cursor is opened ? How can we 
improve database access to be threaded-safe ?

It's very difficult to avoid crash.

Le mardi 25 août 2015 18:21:26 UTC+2, Shai Almog a écrit :
>
> It had me a bit stumped so I consulted with Steve since I don't use the 
> SQLite API myself and he does use it in his apps.
> He says that the thread sensitivity of the API is really great and this 
> becomes a problem since the GC might finalize a connection that wasn't 
> closed properly for you. If it does it on the GC thread then you might 
> physically crash.
>
> I don't like that one bit but I'm not sure how we can workaround it.
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/b3a23afb-92a8-4bcf-bb0f-0247ce25d8f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: New iOS Crash

2017-01-05 Thread Shai Almog
Hi,
it's the wrong way to think about it...
The GC happens. You need to make sure to close connections and cursors when 
you are done with them. Notice that if you don't the simulator should print 
warnings to the console too.

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/fc213b17-5e5c-4abd-ae90-84cbc19dbf94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: New iOS Crash

2017-01-06 Thread Jérémy MARQUER
I'm pretty sure to close all my cursor in finally close using 
Util.cleanup(...) method. About the connection of database, It remain open 
during all life cycle.

I think my problem is related to thread. As you mentioned above, SQLite API 
is not thread safe. I will investigate to wrap this API to make it thread 
safe...



On Friday, January 6, 2017 at 8:01:09 AM UTC+1, Shai Almog wrote:
>
> Hi,
> it's the wrong way to think about it...
> The GC happens. You need to make sure to close connections and cursors 
> when you are done with them. Notice that if you don't the simulator should 
> print warnings to the console too.
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/1bc2a614-ccd9-42cd-9397-4c831bec0cca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: New iOS Crash

2017-01-06 Thread Shai Almog
It's crucial to only use one thread in your connections to SQLite. For 
simplicity we often use the EDT but that might be problematic. In that case 
you will need to guard that the EDT isn't accessing any SQLite data. 

Notice that methods like invokeAndBlock() return different threads and not 
the same thread!

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/5f589636-094b-4eaf-a053-0b2bfba328d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: New iOS Crash

2017-01-09 Thread Jérémy MARQUER
Thanks. 

I've managed my implementation so all database access are executed into one 
thread. ThreadQueue implementation of Steve 
(https://gist.github.com/shannah/2becc8cf4e23b89ef78f) has helped me. FYI, 
I've override all methods of Database class ...


On Saturday, January 7, 2017 at 7:16:09 AM UTC+1, Shai Almog wrote:
>
> It's crucial to only use one thread in your connections to SQLite. For 
> simplicity we often use the EDT but that might be problematic. In that case 
> you will need to guard that the EDT isn't accessing any SQLite data. 
>
> Notice that methods like invokeAndBlock() return different threads and not 
> the same thread!
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/1bd771e4-f7fb-40ac-a5f5-50bbf52060da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.