Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Read-behind gets stuck (None.get) #148

Open
jrray opened this issue Aug 12, 2015 · 0 comments
Open

Read-behind gets stuck (None.get) #148

jrray opened this issue Aug 12, 2015 · 0 comments

Comments

@jrray
Copy link

jrray commented Aug 12, 2015

I am encountering an issue in my application where attempting to remove an item from the queue results in a None.get, and leaves the queue in a state where all subsequent attempts to remove an item fail.

Here's the None.get:

java.util.NoSuchElementException: None.get
>.......at scala.None$.get(Option.scala:274)
>.......at scala.None$.get(Option.scala:272)
>.......at net.lag.kestrel.Journal$$anonfun$fillReadBehind$1.apply(Journal.scala:287)
>.......at net.lag.kestrel.Journal$$anonfun$fillReadBehind$1.apply(Journal.scala:265)
>.......at scala.Option.foreach(Option.scala:197)
>.......at net.lag.kestrel.Journal.fillReadBehind(Journal.scala:265)
>.......at net.lag.kestrel.PersistentQueue.fillReadBehind(PersistentQueue.scala:528)
>.......at net.lag.kestrel.PersistentQueue.net$lag$kestrel$PersistentQueue$$_remove(PersistentQueue.scala:606)
>.......at net.lag.kestrel.PersistentQueue.remove(PersistentQueue.scala:328)
>.......at net.lag.kestrel.PersistentQueue.remove(PersistentQueue.scala:349)

Looking at the code, Journal.journalAfter() is called, which returns Option[String], but the result is assumed to always be defined. readerFilename.get throws the None.get exception, and results in reader still pointing to a now-closed channel.

Subsequent remove() calls:

java.nio.channels.ClosedChannelException
>.......at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:99)
>.......at sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:250)
>.......at net.lag.kestrel.Journal$$anonfun$fillReadBehind$1.apply(Journal.scala:266)
>.......at net.lag.kestrel.Journal$$anonfun$fillReadBehind$1.apply(Journal.scala:265)
>.......at scala.Option.foreach(Option.scala:197)
>.......at net.lag.kestrel.Journal.fillReadBehind(Journal.scala:265)
>.......at net.lag.kestrel.PersistentQueue.fillReadBehind(PersistentQueue.scala:528)
>.......at net.lag.kestrel.PersistentQueue.net$lag$kestrel$PersistentQueue$$_remove(PersistentQueue.scala:606)
>.......at net.lag.kestrel.PersistentQueue.remove(PersistentQueue.scala:328)
>.......at net.lag.kestrel.PersistentQueue.remove(PersistentQueue.scala:349)

Unfortunately I do not know exactly how to reproduce the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant