GithubHelp home page GithubHelp logo

Comments (4)

syspulse avatar syspulse commented on May 24, 2024 1
# uname -a
Linux  5.15.0-79-generic #86~20.04.2-Ubuntu SMP Mon Jul 17 23:27:17 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
# mkfifo /tmp/pipe

ammonite (Ammonite Repl 2.5.4 (Scala 2.13.8 Java 11.0.5)):

import $ivy.`com.typesafe.akka::akka-stream:2.6.19`
import akka.stream._
import akka.stream.scaladsl._
import java.nio.file.{Paths, Files}
import akka.actor.ActorSystem
implicit val as = ActorSystem("Pipe")
implicit val ec = scala.concurrent.ExecutionContext.global
val f = FileIO.fromPath(Paths.get("/tmp/pipe")).to(Sink.foreach{println}).run()

Push data:

echo "1" >/tmp/pipe
[ERROR] [09/27/2023 11:51:00.173] [Pipe-akka.actor.default-blocking-io-dispatcher-8] [akka://Pipe/system/Materializers/StreamSupervisor-0/flow-0-1-fileSource] Error during preStart in [akka.stream.impl.io.FileSource$$anon$2-fileSource]: Nicht erlaubter Seek
java.io.IOException: Nicht erlaubter Seek
        at java.base/sun.nio.ch.FileDispatcherImpl.seek0(Native Method)
        at java.base/sun.nio.ch.FileDispatcherImpl.seek(FileDispatcherImpl.java:78)
        at java.base/sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:361)
        at akka.stream.impl.io.FileSource$$anon$2.preStart(IOSources.scala:74)
        at akka.stream.impl.fusing.GraphInterpreter.init(GraphInterpreter.scala:306)
        at akka.stream.impl.fusing.GraphInterpreterShell.init(ActorGraphInterpreter.scala:619)
        at akka.stream.impl.fusing.ActorGraphInterpreter.tryInit(ActorGraphInterpreter.scala:727)
        at akka.stream.impl.fusing.ActorGraphInterpreter.preStart(ActorGraphInterpreter.scala:776)
        at akka.actor.Actor.aroundPreStart(Actor.scala:548)
        at akka.actor.Actor.aroundPreStart$(Actor.scala:548)
        at akka.stream.impl.fusing.ActorGraphInterpreter.aroundPreStart(ActorGraphInterpreter.scala:716)
        at akka.actor.ActorCell.create(ActorCell.scala:644)
        at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:514)
        at akka.actor.ActorCell.systemInvoke(ActorCell.scala:536)
        at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:295)
        at akka.dispatch.Mailbox.run(Mailbox.scala:230)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

from akka.

johanandren avatar johanandren commented on May 24, 2024

If you can share a reproducer or clear steps to reproduce that would be useful @syspulse

from akka.

johanandren avatar johanandren commented on May 24, 2024

In the FileSource we always read with a position, but that is not supported at all with fifos, additionally, opening a fifo with FileChannel.open will block the thread until there is a write on the other side.

I think we should detect fifos passed to it and fail early saying it is not supported. To stream from a fifo there would need to be a special stream source, but this is the first time I have seen anyone talking about it so it is unlikely to be something we add in core akka streams.

from akka.

johanandren avatar johanandren commented on May 24, 2024

For the record a workaround would be to consume the fifo with a FileInputStream and adapt to stream using StreamConverters.fromInputStream (which expects and handles that the interactions are blocking)

from akka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.