Comments (15)
Sorry for the delay. Were you able to reproduce this? Can you write a junit that demonstrates the issue? We are getting ready to [finally] push 4.49 and I'd like to make sure this isn't an issue.
from ormlite-android.
I haven't tried to reproduce that. Error has been reported by ACRA from some user. Currently there is several such reports and additionally several almost the same, with message: disk I/O error (code 778)
all of them comes from Samsung GT-I9100 with android 4.1.2 (not from one app installation). That may be a bug(s) in particular version of sqlite native library.
from ormlite-android.
If you're seeing this on a single device/version, that will be very difficult to reproduce. Any idea if this is from a single user? The sqlite error code specifically suggests a hardware issue. Not sure that is the issue, but if its possibly a single user, its fairly likely. https://www.sqlite.org/rescode.html#ioerr_write
from ormlite-android.
I've got 10 automatic reports (sent by ACRA) from 3 different installations. If we assume that users has not cleaned app data nor reinstall an app then then there are 3 users.
- user #1 - 2x cannot rollback
- user #2 - 1x disk I/O error
- user #3 - 3x disk I/O error, 4x cannot rollback
from ormlite-android.
Hrm. Interesting. Is there any chance that multiple threads are using callBatchTasks(...)
at the same time? Since there is one database connection, two threads might be clashing when they try to start and end transactions.
from ormlite-android.
I've just added the following to the notes in Dao.callBatchTasks(...)
:
NOTE: Depending on your underlying database implementation and whether or not you are working with a single database connection, you may need to synchronize around calls to this method otherwise the database transactions that are used may clash when called simultaneously from multiple threads. You may also need to synchronize other calls to transactions and dao.setAutoCommit(...)
.
from ormlite-android.
Related to #16
from ormlite-android.
Reopen this issue if threading is not the problem. Thanks.
from ormlite-android.
I guess one question would be should ORMLite be forcing the synchronization?
from ormlite-android.
It was possible that multiple threads used transactions at the same time. Isn't there any mechanism that prevents such clashes in Android SQLite related classes? I see eg. SQLiteSession#TRANSACTION_MODE_EXCLUSIVE.
from ormlite-android.
I wouldn't do any locking in ORMLite for the sake of Android. If you're using one SqliteOpenHelper globally in your app, multiple threads are OK. There's synchronization happening at the Java level. If you have multiple open helper instances, or multiple processes accessing the db, then you have issues.
If you're having multi-threading issues, we'd need to see more code and how you're accessing the db. This is very well word territory from an Android perspective, though. If there's a threading issue, its pretty much always that you have more than one connection open.
from ormlite-android.
For reference: http://stackoverflow.com/questions/2493331/what-are-the-best-practices-for-sqlite-on-android/3689883#3689883
from ormlite-android.
I am using one global helper instance, app has only one process and I am not touching the database without OrmLite. Instance of the helper is acquired like this: OpenHelperManager.getHelper(this, DatabaseHelper.class);
in application's onCreate()
only, DatabaseHelper
extends OrmLiteSqliteOpenHelper
. Any more info would be helpful?
from ormlite-android.
Can't really do anything without a way to reproduce the issue. at a minimum we'd need to see your code. We're just looking at a stack trace and a description of the issue.
from ormlite-android.
Here it is:
final Calendar cal = getCalendarWithTimezone();
final RuntimeExceptionDao<LocalUsage, Integer> localUsageDao = getLocalUsageDao();
final long oldestTimestamp = getOldestTimestamp();
final long baseUsage = getBaseUsage();
final long bootTimestamp = getBootTimestamp();
localUsageDao.callBatchTasks(new Callable<Void>()
{
@Override
public Void call() throws Exception
{
while (cal.getTimeInMillis() > oldestTimestamp)
{
long usage = cal.getTimeInMillis() > bootTimestamp ? baseUsage : -1L;
localUsageDao.createOrUpdate(new LocalUsage(cal.getTimeInMillis(), usage));
cal.add(Calendar.DAY_OF_MONTH, -1);
}
return null;
}
});
LocalUsage
constructor does nothing except assigning field values.
I guess that database file could not be saved when commiting transaction due to some I/O failure (as described in your link). Some bug related to file I/O may exist in that particular ROM of SGS2. Maybe it will be possible to reproduce that with messing up with database file when transaction is in progress eg. corrupting it.
from ormlite-android.
Related Issues (20)
- android ,执行update操作,总是返回0 HOT 4
- ORMLite Android - Prevent Upgrade inside catch HOT 2
- The connection pool for database has been unable to grant a connection in ORMLite 5.1 HOT 5
- Missing or reset data HOT 3
- getReadWriteConnection: SQLiteCantOpenDatabaseException unknown error (Sqlite code 14): Could not open database, (OS error - 13:Permission denied)
- Is there any way we can get a 5.2 release to benefit from a bugfix in core 5.2? HOT 1
- Feature Request: SupportSQLiteOpenHelper HOT 2
- Null variable AndroidLogBackend causes "Could not construct instance of helper class" HOT 2
- UpdateBuilder use Nonparametric statement cause sql injection problem HOT 3
- Exception when create object with string including single quote HOT 2
- log4j HOT 2
- how to join two table? HOT 2
- [Bug] Using Limit and Offset causes SQL exception. HOT 3
- Duplicate classes and files when depending on a project using ormlite-core HOT 6
- Can't use a dependency with ormlite annotations. HOT 3
- Does ormlite support In-Memory database? HOT 1
- R8 minifyEnabled proguard rules
- EXTERNAL DATA IN SQL QUERIES [SAST] [M7] [CWE-89]
- Security vulnerability - SQL injection
- dao.queryForId() returns null even though row exists HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ormlite-android.