martinrybak / SQLClient

Native Microsoft SQL Server client for iOS
http://objcsharp.wordpress.com/2013/10/15/an-open-source-sql-server-library-for-ios/
MIT License
124 stars 51 forks source link

Crash with the login variable #9

Closed ghost closed 7 years ago

ghost commented 10 years ago

I have an app that executes a query every 5 seconds, at some point of executing a query it crashes by a “bad access error” in the methods connection failure and connection success, it appears that at some point the login variable gets freed and the bad access exception is thrown crashing my app. I haven’t been able to track this error to a possible fix. Another thing to mention, is that this happens on the iOS simulator, i have not been able to test the app in a real device.

Hope the image looks well, and help with the issue.

image

ghost commented 10 years ago

Forgot to tell you, this happens only sometimes

martinrybak commented 10 years ago

Just checking, you are using the latest release (0.1.3)?

ghost commented 10 years ago

Yes, i downloaded it yesterday, and updated the one on my project

ghost commented 10 years ago

I think the following is happening, and the issue is the automatic update, if a thread starts and its life ends at the start of the following automatic update, the first thread may free memory that the second thread will use at some point, so it causes the app to crash when the second thread access a location that was deallocated by the first.

I think one solution can be increasing the automatic update time from 5 seconds to 10 or 15 can solve the issue of the memory that the first thread deallocates, and the second thread try to access.

Regards, Francisco

ghost commented 10 years ago

I closed it by mistake.... without waiting an answer... Sorry haha

alexmolskiy commented 10 years ago

I`v got the same error, tested only in simulator, can not test it on real device.

martinrybak commented 7 years ago

This issue has been fixed on the types branch.