Skip to content

Addon with docker results in Joex raising java.nio.file.NotDirectoryException #2650

@tiborrr

Description

@tiborrr

Using an addon that depends on a docker image results in a error:

2024.05.22 10:00:01:0016 [io-comp...] [INFO ] docspell.scheduler.impl.LogSink.logInternal:41 - >>> 2024-05-22T08:00:01.663265642Z Info 61chMgjio.../1/process-item/High: Running 1 addon tasks for trigger Set(FinalProcessItem) (jobId: "61chMgjio9M-Y4vwYtzsoWT-2vYRKG27DLy-Y1TqfoRoFii", task: "process-item", group: "1", jobInfo: "61chMgjio.../1/process-item/High")
2024.05.22 10:00:01:0001 [io-comp...] [TRACE] docspell.store.impl.DoobieLogging.run:24 - SQL: INSERT INTO joblog (id, jid, level, created, message) VALUES (?,?,?,?,? )  (List(Ident(GQec5SbafBj-FrqbU1CaHFe-H36mXxrCBWq-j7tbTvzPbWA), Ident(61chMgjio9M-Y4vwYtzsoWT-2vYRKG27DLy-Y1TqfoRoFii), Info, Timestamp(2024-05-22T08:00:01.663265642Z), Running 1 addon tasks for trigger Set(FinalProcessItem))) executed in 366751 nanoseconds
2024.05.22 10:00:01:0017 [io-comp...] [WARN ] docspell.backend.joex.AddonPrepare.logResult:35 - Addon task '2PFFh4F5eiw-mqKsBKkEqUP-LmUho82NfuF-VPg2p2vH1Zt' has failed
java.nio.file.NotDirectoryException: /tmp/docspell-addons/addon-17931550648262311479/addons/rita-addon-0.33.0/docspell-addon.yml
        at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:419)
        at java.nio.file.Files.newDirectoryStream(Files.java:482)
        at java.nio.file.Files.list(Files.java:3792)
        at fs2.io.file.FilesCompanionPlatform$AsyncFiles.$anonfun$list$1(FilesPlatform.scala:304)
        at make @ docspell.common.ThreadFactories$.executorResource(ThreadFactories.scala:48)
        at make @ docspell.common.ThreadFactories$.executorResource(ThreadFactories.scala:48)
        at uncancelable @ fs2.Pull$.acquireCancelable(Pull.scala:423)
        at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
        at handleErrorWith @ fs2.Compiler$Target.handleErrorWith(Compiler.scala:161)
        at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
        at uncancelable @ fs2.Compiler$Target.uncancelable(Compiler.scala:165)
        at unique @ fs2.Compiler$Target$ConcurrentTarget.unique(Compiler.scala:194)
        at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
        at ref @ fs2.concurrent.SignallingRef$.of(Signal.scala:240)
        at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
        at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
 (addon-task-id: "2PFFh4F5eiw-mqKsBKkEqUP-LmUho82NfuF-VPg2p2vH1Zt")
2024.05.22 10:00:01:0002 [io-comp...] [DEBUG] docspell.scheduler.impl.LogSink.logInternal:43 - >>> 2024-05-22T08:00:01.666582010Z Debug 61chMgjio.../1/process-item/High: Preparing item data 'test_text.pdf' for addon (jobId: "61chMgjio9M-Y4vwYtzsoWT-2vYRKG27DLy-Y1TqfoRoFii", task: "process-item", group: "1", jobInfo: "61chMgjio.../1/process-item/High")
2024.05.22 10:00:01:0024 [io-comp...] [TRACE] docspell.store.impl.DoobieLogging.run:24 - SQL: INSERT INTO joblog (id, jid, level, created, message) VALUES (?,?,?,?,? )  (List(Ident(8cJ7TAGsS4m-eVDqWL3hEs8-kusPQkHmvVr-qQoE55a8WYM), Ident(61chMgjio9M-Y4vwYtzsoWT-2vYRKG27DLy-Y1TqfoRoFii), Debug, Timestamp(2024-05-22T08:00:01.666582010Z), Preparing item data 'test_text.pdf' for addon)) executed in 320437 nanoseconds
2024.05.22 10:00:01:0018 [io-comp...] [TRACE] docspell.store.impl.DoobieLogging.run:24 - SQL: SELECT job.retries FROM job  WHERE job.jid = ?   (List(Ident(61chMgjio9M-Y4vwYtzsoWT-2vYRKG27DLy-Y1TqfoRoFii))) executed in 431290 nanoseconds
2024.05.22 10:00:01:0019 [io-comp...] [ERROR] docspell.scheduler.impl.SchedulerImpl.wrapTask:304 - Job 61chMgjio.../1/process-item/High execution failed. Retrying later.

You can use the following link to check the repo and docker image that I have used:

https://github.com/tiborrr/docspell-addon-example/releases/tag/0.6.0

meta:
  name: "docspell-addon-example"
  version: "0.7.0"
  description: |
    This is a minimal example of a docspell addon. It does nothing but print Hello and the argument that was passed to it.
triggers:
  - final-process-item
runner:
  docker:
    enable: true
    image: tiborr/docspell-addon-example:latest
options:
  networking: false
  collectOutput: true

This code should be run in this container.

import sys

def main():
    if len(sys.argv) > 1:
        print(f"Hello {sys.argv[1]}")
    else:
        print("Hello")

if __name__ == "__main__":
    main()

Full implementation can be found here:

https://github.com/tiborrr/docspell-addon-example

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working or in unexpected ways

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions