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

Adding ledger with no "insert" clause hangs #37

Open
alan-deronyan opened this issue Feb 9, 2024 · 2 comments
Open

Adding ledger with no "insert" clause hangs #37

alan-deronyan opened this issue Feb 9, 2024 · 2 comments

Comments

@alan-deronyan
Copy link

alan-deronyan commented Feb 9, 2024

I'm adding a ledger, but forgot to add the "insert" clause.

Client (postman) consistently hangs on my request, and the server throws some exceptions (attached below).

Request Body:

{
    "ledger": "rdfs/void"
}

curl:

curl --location 'http://localhost:58090/fluree/create' \
--header 'Content-Type: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "ledger": "rdfs/void"
}'

Server Logs:

19:23:27.105 [clojure-agent-send-off-pool-0] INFO  fluree.db.json-ld.api - Creating ledger "rdfs/void"
19:23:27.121 [async-dispatch-6] ERROR fluree.db.json-ld.api - #error {
 :cause "Invalid transaction, insert or delete clause must contain nodes with objects."
 :data {:status 400, :error :db/invalid-transaction}
 :via
 [{:type clojure.lang.ExceptionInfo
   :message "Invalid transaction, insert or delete clause must contain nodes with objects."
   :data {:status 400, :error :db/invalid-transaction}
   :at [fluree.db.query.fql.parse$parse_txn invokeStatic "parse.cljc" 646]}]
 :trace
 [[fluree.db.query.fql.parse$parse_txn invokeStatic "parse.cljc" 646]
  [fluree.db.query.fql.parse$parse_txn invoke "parse.cljc" 629]
  [fluree.db.json_ld.transact$stage$fn__39171$state_machine__14611__auto____39180$fn__39183 invoke "transact.cljc" 214]
  [fluree.db.json_ld.transact$stage$fn__39171$state_machine__14611__auto____39180 invoke "transact.cljc" 212]
  [clojure.core.async.impl.ioc_macros$run_state_machine invokeStatic "ioc_macros.clj" 972]
  [clojure.core.async.impl.ioc_macros$run_state_machine invoke "ioc_macros.clj" 971]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invokeStatic "ioc_macros.clj" 976]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invoke "ioc_macros.clj" 974]
  [fluree.db.json_ld.transact$stage$fn__39171 invoke "transact.cljc" 212]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.util.concurrent.ThreadPoolExecutor runWorker nil -1]
  [java.util.concurrent.ThreadPoolExecutor$Worker run nil -1]
  [clojure.core.async.impl.concurrent$counted_thread_factory$reify__9575$fn__9576 invoke "concurrent.clj" 29]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run nil -1]]}
19:23:27.121 [clojure-agent-send-off-pool-0] ERROR f.s.components.consensus-handler - "Unexpected error in processor function for event :ledger-create with message: Invalid transaction, insert or delete clause must contain nodes with objects."
clojure.lang.ExceptionInfo: Invalid transaction, insert or delete clause must contain nodes with objects.
        at fluree.db.query.fql.parse$parse_txn.invokeStatic(parse.cljc:646)
        at fluree.db.query.fql.parse$parse_txn.invoke(parse.cljc:629)
        at fluree.db.json_ld.transact$stage$fn__39171$state_machine__14611__auto____39180$fn__39183.invoke(transact.cljc:214)
        at fluree.db.json_ld.transact$stage$fn__39171$state_machine__14611__auto____39180.invoke(transact.cljc:212)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:972)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:971)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:976)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:974)
        at fluree.db.json_ld.transact$stage$fn__39171.invoke(transact.cljc:212)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at clojure.core.async.impl.concurrent$counted_thread_factory$reify__9575$fn__9576.invoke(concurrent.clj:29)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Unknown Source)

If I go back and fix the request, it still hangs, as the previous creation attempt is "stuck"...

Request body:

{
    "ledger": "rdfs/void", 
    "insert": { "foo": "bar" }
}

curl:

curl --location 'http://localhost:58090/fluree/create' \
--header 'Content-Type: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "ledger": "rdfs/void", 
    "insert": { "foo": "bar" }
}'

Server logs:

19:27:31.901 [async-dispatch-12] WARN  f.s.consensus.handlers.create-ledger - "Ledger id is already pending creation: rdfs/void"
19:27:31.902 [async-dispatch-4] INFO  fluree.server.handlers.create - Ledger created: nil
19:27:31.902 [clojure-agent-send-off-pool-1] INFO  fluree.db.json-ld.api - Creating ledger nil
Exception in thread "async-dispatch-12" java.lang.NullPointerException: Cannot invoke "Object.toString()" because "s" is null
        at clojure.string$starts_with_QMARK_.invokeStatic(string.clj:365)
        at clojure.string$starts_with_QMARK_.invoke(string.clj:361)
        at fluree.db.json_ld.api$address_QMARK_.invokeStatic(api.cljc:104)
        at fluree.db.json_ld.api$address_QMARK_.invoke(api.cljc:100)
        at fluree.db.json_ld.api$exists_QMARK_$fn__61975$state_machine__14611__auto____61980$fn__61982.invoke(api.cljc:152)
        at fluree.db.json_ld.api$exists_QMARK_$fn__61975$state_machine__14611__auto____61980.invoke(api.cljc:151)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:972)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:971)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:976)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:974)
        at fluree.db.json_ld.api$exists_QMARK_$fn__61975.invoke(api.cljc:151)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at clojure.core.async.impl.concurrent$counted_thread_factory$reify__9575$fn__9576.invoke(concurrent.clj:29)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "async-dispatch-4" java.lang.NullPointerException
19:27:31.902 [async-dispatch-15] ERROR fluree.db.json-ld.api - #error {
 :cause "Cannot invoke \"Object.toString()\" because \"s\" is null"
 :via
 [{:type java.lang.NullPointerException
   :message "Cannot invoke \"Object.toString()\" because \"s\" is null"
   :at [clojure.string$starts_with_QMARK_ invokeStatic "string.clj" 365]}]
 :trace
 [[clojure.string$starts_with_QMARK_ invokeStatic "string.clj" 365]
  [clojure.string$starts_with_QMARK_ invoke "string.clj" 361]
  [fluree.db.ledger.json_ld$normalize_alias invokeStatic "json_ld.cljc" 191]
  [fluree.db.ledger.json_ld$normalize_alias invoke "json_ld.cljc" 188]
  [fluree.db.ledger.json_ld$create_STAR_$fn__58612$state_machine__14611__auto____58619$fn__58622 invoke "json_ld.cljc" 239]
  [fluree.db.ledger.json_ld$create_STAR_$fn__58612$state_machine__14611__auto____58619 invoke "json_ld.cljc" 214]
  [clojure.core.async.impl.ioc_macros$run_state_machine invokeStatic "ioc_macros.clj" 972]
  [clojure.core.async.impl.ioc_macros$run_state_machine invoke "ioc_macros.clj" 971]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invokeStatic "ioc_macros.clj" 976]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invoke "ioc_macros.clj" 974]
  [fluree.db.ledger.json_ld$create_STAR_$fn__58612 invoke "json_ld.cljc" 214]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.util.concurrent.ThreadPoolExecutor runWorker nil -1]
  [java.util.concurrent.ThreadPoolExecutor$Worker run nil -1]
  [clojure.core.async.impl.concurrent$counted_thread_factory$reify__9575$fn__9576 invoke "concurrent.clj" 29]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run nil -1]]}
19:27:31.902 [clojure-agent-send-off-pool-1] ERROR f.s.components.consensus-handler - "Unexpected error in processor function for event :ledger-create with message: Cannot invoke \"Object.toString()\" because \"s\" is null"
java.lang.NullPointerException: Cannot invoke "Object.toString()" because "s" is null
        at clojure.string$starts_with_QMARK_.invokeStatic(string.clj:365)
        at clojure.string$starts_with_QMARK_.invoke(string.clj:361)
        at fluree.db.ledger.json_ld$normalize_alias.invokeStatic(json_ld.cljc:191)
        at fluree.db.ledger.json_ld$normalize_alias.invoke(json_ld.cljc:188)
        at fluree.db.ledger.json_ld$create_STAR_$fn__58612$state_machine__14611__auto____58619$fn__58622.invoke(json_ld.cljc:239)
        at fluree.db.ledger.json_ld$create_STAR_$fn__58612$state_machine__14611__auto____58619.invoke(json_ld.cljc:214)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:972)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:971)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:976)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:974)
        at fluree.db.ledger.json_ld$create_STAR_$fn__58612.invoke(json_ld.cljc:214)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at clojure.core.async.impl.concurrent$counted_thread_factory$reify__9575$fn__9576.invoke(concurrent.clj:29)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.base/java.lang.Thread.run(Unknown Source)
@alan-deronyan alan-deronyan changed the title Cannot add ledger named "rdfs/void" Adding ledger with no "insert" or "delete" clause hangs Feb 9, 2024
@alan-deronyan alan-deronyan changed the title Adding ledger with no "insert" or "delete" clause hangs Adding ledger with no "insert" clause hangs Feb 9, 2024
@alan-deronyan
Copy link
Author

Additional note - restarting the server doesn't help. Only wiping the data volume fixes it.

@alan-deronyan
Copy link
Author

alan-deronyan commented Feb 12, 2024

One additional note - a simple insert with just an "@id" value also causes the hang. e.g....

{"ledger": "foo/bar","insert": [{ "@id": "foo" }]}

is invalid.

In order to succeed, the insert must have material data, like { "foo": "bar" }

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

1 participant