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

[Bug]: java.lang.IllegalArgumentException #551

Open
awb99 opened this issue Jul 14, 2022 · 3 comments
Open

[Bug]: java.lang.IllegalArgumentException #551

awb99 opened this issue Jul 14, 2022 · 3 comments
Labels
bug Something isn't working triage

Comments

@awb99
Copy link

awb99 commented Jul 14, 2022

What version of Datahike are you using?

"0.4.1480" with konserve "0.6.0-alpha3"

What version of Java are you using?

17.0.1

What operating system are you using?

Debian GNU/Linux 9.13 (stretch)

What database EDN configuration are you using?

{:store {:backend :file
:path "data/datahike-db"}
:keep-history? false}

Describe the bug

My db is running for 6 weeks live, and now I get this exception on datahike transact:

Supervisor: #error {
 :cause class java.lang.IllegalArgumentException cannot be cast to class clojure.lang.Associative (java.lang.IllegalArgumentExceptioni
s in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')
 :via
 [{:type java.lang.ClassCastException
   :message class java.lang.IllegalArgumentException cannot be cast to class clojure.lang.Associative (java.lang.IllegalArgumentExcept
ion is in module java.base of loader 'bootstrap'; clojure.lang.Associative is in unnamed module of loader 'app')
   :at [clojure.lang.RT assoc RT.java 827]}]
 :trace
 [[clojure.lang.RT assoc RT.java 827]
  [clojure.core$assoc__5433 invokeStatic core.clj 193]
  [clojure.core$assoc__5433 invoke core.clj 192]
  [hitchhiker.tree.bootstrap.konserve.KonserveAddr _resolve_chan konserve.cljc 72]
  [hitchhiker.tree.messaging$enqueue invokeStatic messaging.cljc 81]
  [hitchhiker.tree.messaging$enqueue invoke messaging.cljc 31]
  [hitchhiker.tree.messaging$enqueue invokeStatic messaging.cljc 81]
  [hitchhiker.tree.messaging$enqueue invoke messaging.cljc 31]
  [hitchhiker.tree.messaging$enqueue invokeStatic messaging.cljc 35]
  [hitchhiker.tree.messaging$enqueue invoke messaging.cljc 31]
  [datahike.index.hitchhiker_tree$_upsert invokeStatic hitchhiker_tree.cljc 142]
  [datahike.index.hitchhiker_tree$_upsert invoke hitchhiker_tree.cljc 140]
[datahike.index.hitchhiker_tree$_upsert invokeStatic hitchhiker_tree.cljc 142]                                            [476/9103]
  [datahike.index.hitchhiker_tree$_upsert invoke hitchhiker_tree.cljc 140]
  [datahike.index$eval53960$fn__53975 invoke index.cljc 62]
  [datahike.index$eval53758$fn__53794$G__53741__53805 invoke index.cljc 8]
  [datahike.db$with_datom_upsert$fn__56606 invoke db.cljc 1584]
  [clojure.lang.AFn applyToHelper AFn.java 154]
  [clojure.lang.AFn applyTo AFn.java 144]
  [clojure.core$apply invokeStatic core.clj 669]
  [clojure.core$update_in$up__6870 invoke core.clj 6174]
  [clojure.core$update_in invokeStatic core.clj 6175]
  [clojure.core$update_in doInvoke core.clj 6161]
  [clojure.lang.RestFn invoke RestFn.java 445]
  [datahike.db$with_datom_upsert invokeStatic db.cljc 1584]
  [datahike.db$with_datom_upsert invoke db.cljc 1565]
  [clojure.lang.AFn applyToHelper AFn.java 156]
  [clojure.lang.AFn applyTo AFn.java 144]
  [clojure.core$apply invokeStatic core.clj 669]
  [clojure.core$update_in$up__6870 invoke core.clj 6174]
  [clojure.core$update_in invokeStatic core.clj 6175]
  [clojure.core$update_in doInvoke core.clj 6161]
  [clojure.lang.RestFn invoke RestFn.java 467]
  [datahike.db$transact_report invokeStatic db.cljc 1601]
  [datahike.db$transact_report invoke db.cljc 1594]
  [datahike.db$transact_add invokeStatic db.cljc 1724]
  [datahike.db$transact_add invoke db.cljc 1713]
  [datahike.db$transact_tx_data invokeStatic db.cljc 2034]
  [datahike.db$transact_tx_data invoke db.cljc 1822]
  [datahike.core$with invokeStatic core.cljc 129]
  [datahike.core$with invoke core.cljc 122]
  [datahike.core$_transact_BANG_$fn__59950 invoke core.cljc 212]
[datahike.core$with invoke core.cljc 122]                                                                                 [448/9103]
  [datahike.core$_transact_BANG_$fn__59950 invoke core.cljc 212]
  [clojure.lang.Atom swap Atom.java 37]
  [clojure.core$swap_BANG_ invokeStatic core.clj 2356]
  [clojure.core$swap_BANG_ invoke core.clj 2349]
  [datahike.core$_transact_BANG_ invokeStatic core.cljc 211]
  [datahike.core$_transact_BANG_ invoke core.cljc 208]
  [datahike.core$transact_BANG_ invokeStatic core.cljc 229]
  [datahike.core$transact_BANG_ invoke core.cljc 225]
  [datahike.core$transact invokeStatic core.cljc 327]
  [datahike.core$transact invoke core.cljc 320]
  [datahike.core$transact invokeStatic core.cljc 324]
  [datahike.core$transact invoke core.cljc 320]
  [clojure.lang.Var invoke Var.java 388]
  [datahike.connector$update_and_flush_db invokeStatic connector.cljc 24]
  [datahike.connector$update_and_flush_db invoke connector.cljc 23]
  [datahike.transactor$create_rx_thread$fn__60082$fn__60084 invoke transactor.cljc 34]
  [datahike.transactor$create_rx_thread$fn__60082 invoke transactor.cljc 34]
  [clojure.core.async$thread_call$fn__25477 invoke async.clj 484]
  [clojure.lang.AFn run AFn.java 22]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1136]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 635]
  [java.lang.Thread run Thread.java 833]]}

What is the expected behaviour?

no exception.

How can the behaviour be reproduced?

I could upload my datahike dump if this is of any help

@awb99 awb99 added bug Something isn't working triage labels Jul 14, 2022
@awb99
Copy link
Author

awb99 commented Jul 14, 2022

what is interesting is that the exception that I copied above only is shown in the console. I am catching exceptions,
but I guess due to core.async channels the exceptions do not bubble up to the caller

@awb99
Copy link
Author

awb99 commented Jul 14, 2022

I have found an out of memory exception. But I am not sure if this out of memory exception caused the exception above, or if the exception above caused the out of memory exceptions. Very hard to tell, as my logging system (timbre) does not log any exception (because this exceptions are inside konserve/datahike, and my exception handling clause does not get thiem).

Exception in thread "async-dispatch-13" java.lang.OutOfMemoryError: Java heap space
        at net.jpountz.lz4.LZ4FrameOutputStream.<init>(LZ4FrameOutputStream.java:138)
        at net.jpountz.lz4.LZ4FrameOutputStream.<init>(LZ4FrameOutputStream.java:115)
        at net.jpountz.lz4.LZ4FrameOutputStream.<init>(LZ4FrameOutputStream.java:102)
        at net.jpountz.lz4.LZ4FrameOutputStream.<init>(LZ4FrameOutputStream.java:156)
        at net.jpountz.lz4.LZ4FrameOutputStream.<init>(LZ4FrameOutputStream.java:168)
        at konserve.compressor.Lz4Compressor._serialize(compressor.cljc:13)
        at konserve.encryptor.NullEncryptor._serialize(encryptor.clj:10)
        at konserve.filestore$write_edn.invokeStatic(filestore.clj:165)
        at konserve.filestore$write_edn.invoke(filestore.clj:161)
        at konserve.filestore$update_file$fn__47777$state_machine__25204__auto____47858$fn__47860.invoke(filestore.clj:225)
        at konserve.filestore$update_file$fn__47777$state_machine__25204__auto____47858.invoke(filestore.clj:223)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:978)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:977)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:982)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:980)
        at clojure.core.async.impl.ioc_macros$take_BANG_$fn__25222.invoke(ioc_macros.clj:991)
        at clojure.core.async.impl.channels.ManyToManyChannel$fn__20012.invoke(channels.clj:269)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at clojure.core.async.impl.concurrent$counted_thread_factory$reify__19816$fn__19817.invoke(concurrent.clj:29)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Thread.java:833)

@whilo
Copy link
Member

whilo commented Mar 16, 2023

My apologies that you ran into this problem! We have fixed a memory leak that was present with the hitchhiker-tree caching and was very likely responsible for this problem. This is fixed with recent releases if you use the persistent-sorted-set, which is strongly recommended for now also for its much better read performance. We have also fixed a bug where some exceptions in the transactor were not properly propagated, which might have been the case here. Do you have the opportunity to move over to the persistent sorted set backend and retry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants