Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception caught when box.put is called #17

Closed
madqueendany opened this issue Aug 18, 2019 · 10 comments
Closed

Exception caught when box.put is called #17

madqueendany opened this issue Aug 18, 2019 · 10 comments

Comments

@madqueendany
Copy link

madqueendany commented Aug 18, 2019

I got this error after some time when calling put

Unhandled Exception: RangeError: Value not in range

Stacktrace as follows (trace from the app prior to the hive related trace is not included)

flutter: .. products fetched from the api.
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: RangeError: Value not in range: -674520
#0      _rangeCheck  (dart:typed_data-patch/typed_data_patch.dart:4442:5)
#1      _ByteBuffer.asUint8List  (dart:typed_data-patch/typed_data_patch.dart:1923:5)
#2      new Uint8List.view (dart:typed_data:820:19)
#3      BufferedFileReader.read 
package:hive/…/io/buffered_file_reader.dart:47
<asynchronous suspension>
#4      StorageBackendVm.compact.<anonymous closure>.<anonymous closure> 
package:hive/…/backend/storage_backend_vm.dart:186
<asynchronous suspension>
#5      Lock.synchronized 
package:hive/…/util/lock.dart:18
<asynchronous suspension>
#6      StorageBackendVm.compact.<anonymous closure> 
package:hive/…/backend/storage_backend_vm.dart:174
#7      Lock.synchronized 
package:hive/…/util/lock.dart:18
<asynchronous suspension>
#8      StorageBackendVm.compact 
package:hive/…/backend/storage_backend_vm.dart:173
<asynchronous suspension>
#9      BoxImpl.compact (pack<…>
Error calling sqlite3_step (1: cannot rollback - no transaction is active) SQLITE_ERROR
DB Query: ROLLBACK
Unknown error finalizing or resetting statement (1: cannot rollback - no transaction is active)
DB Query: ROLLBACK

For context, I'm trying to put a big amount of data into the box (like a list of 100 Map<String, dynamic> with detailed attributes.

It might be the cause of the exception but the exception should state that. Initially, the IDE (VSCode) pauses for an exception but I can't see any stacktrace and the offending line is not presented. I was able to see the exception when I unticked Uncaught Exceptions

@simc
Copy link
Member

simc commented Aug 18, 2019

@madqueendany

What version of Hive are you using?

Edit: 100 entries should be no problem at all...

@madqueendany
Copy link
Author

madqueendany commented Aug 18, 2019

I'm using ^0.3.0+1

Didn't realize that it's now updated to 0.4.0! I'll update and try. Thanks!

@simc
Copy link
Member

simc commented Aug 18, 2019

Thanks. Let me know if the problem persists.

@madqueendany
Copy link
Author

madqueendany commented Aug 18, 2019

Okay I tried updating to 0.4.0 but I got this error message on flutter packages get

Because every version of flutter_test from sdk depends on path 1.6.2 and hive >=0.4.0 depends on path ^1.6.4, flutter_test from sdk is incompatible with hive >=0.4.0

Is it high time to upgrade flutter?

I'm currently on 1.5.4-hotfix.2

and my sdk environment is >=2.2.2 <3.0.0

@simc
Copy link
Member

simc commented Aug 18, 2019

It works with the current stable (v1.7.8+hotfix.4) with the next version of Hive, I'll add more tolerance for this dependency.

@madqueendany
Copy link
Author

Thanks. I'm a little bit on the fence when upgrading flutter. I'll look forward to the next version.

@simc
Copy link
Member

simc commented Aug 18, 2019

I published version 0.4.1 which should work for you ;)

@madqueendany
Copy link
Author

What a champ. I'll have to test this tomorrow. Thanks buddy

@madqueendany
Copy link
Author

Everything seems to be working fine now. Thanks for your assistance!

@simc
Copy link
Member

simc commented Aug 19, 2019

Great 👍 please open another issue if you find a problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants