Skip to content

axle's dosync preventing jdbc transactions during component start #1

@bwalex

Description

@bwalex

Hi! I was trying out runway on one of my projects, and pretty quickly ran into an exception getting thrown from next.jdbc's transaction handling, which has an explicit io! block.

Said transaction is run as part of one of the component's start lifecycle methods to effectively apply database migrations when needed.

Here's the trace,

backend |                clojure.core/binding-conveyor-fn/fn                 core.clj: 2047
backend |                             axle.core/window/fn/fn                 core.clj:  133
backend |                                                ...
backend |                          axle.core/window/fn/fn/fn                 core.clj:  133
backend |                                                ...
backend |                                 clojure.core/alter                 core.clj: 2460
backend |                                 clojure.core/alter                 core.clj: 2470
backend |                                                ...
backend |                             axle.core/wrap-init/fn                 core.clj:  114
backend |                            clojure.core/partial/fn                 core.clj: 2642
backend |                              runway.core/reduce-fx                 core.clj:  410
backend |                                 runway.core/try-fx                 core.clj:  399
backend |                                                ...
backend |                           runway.core/eval64268/fn                 core.clj:  227
backend |                                  runway.core/start                 core.clj:  108
backend |                           runway.core/alter-system                 core.clj:  103
backend |                                                ...
backend |                        clojure.core/alter-var-root                 core.clj: 5530
backend |                        clojure.core/alter-var-root                 core.clj: 5535
backend |                                                ...
backend |               runway.core/alter-system/try-recover                 core.clj:  100
backend |                               runway.core/start/fn                 core.clj:  113
backend |         com.stuartsierra.component.SystemMap/start           component.cljc:  179
backend |            com.stuartsierra.component/start-system           component.cljc:  162
backend |            com.stuartsierra.component/start-system           component.cljc:  164
backend |                                                ...
backend |           com.stuartsierra.component/update-system           component.cljc:  130
backend |           com.stuartsierra.component/update-system           component.cljc:  136
backend |                                clojure.core/reduce                 core.clj: 6885
backend |                                                ...
backend |        com.stuartsierra.component/update-system/fn           component.cljc:  140
backend |              com.stuartsierra.component/try-action           component.cljc:  118
backend |                                 clojure.core/apply                 core.clj:  669
backend |                                                ...
backend |           com.stuartsierra.component/eval9064/fn/G           component.cljc:    5 (repeats 2 times)
[...]
backend |                                 next.jdbc/transact                 jdbc.clj:  381
backend |                  next.jdbc.protocols/eval3282/fn/G            protocols.clj:   57
backend |                  next.jdbc.transaction/eval4290/fn          transaction.clj:  121
backend |                    next.jdbc.transaction/transact*          transaction.clj:   65
backend | java.lang.IllegalStateException: I/O in transaction

Can you think of a suitable workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions