kclay / rethink-scala

Scala Driver for RethinkDB
Other
100 stars 24 forks source link

[ClassCastException: java.nio.channels.ClosedChannelException cannot be cast to scala.collection.Seq] #13

Closed ohde closed 9 years ago

ohde commented 10 years ago

I updated and switched to version 3 for JSON support and now I am having trouble running my existing code.

val auth = coreBroker.authenticatorsTable.filter(Map("authId" -> id)).run match {
    case Right(x) => if(x.size == 0) None else Some(x.head)
    case Left(x) => None
}

Please let me know if after switching I need to change something else. Thanks.

kclay commented 10 years ago

I'll push a fix for this, I actually never implemented the json serialization should of mentioned that in the readme lol. I'm fixing a few things I broke for the change-feed support so once I get that fixed and all tests pass I'll push an update.

kclay commented 10 years ago

Pushed new snapshot give it a try also you can do

val auth  = coreBroker.authenticatorsTable.filter(Map("authId" -> id))(0).toOpt 
kclay commented 10 years ago

Actually publish new version 0.4.4

ohde commented 10 years ago

Interesting, I pulled the latest and ensured Version 3 was being used, and I get the following at runtime:

[error] c.r.n.Version3 - Unable to read from socket
java.io.IOException: null
    at org.jboss.netty.handler.queue.BlockingReadHandler.read(BlockingReadHandler.java:170) ~[netty-3.9.2.Final.jar:na]
    at com.rethinkscala.net.ConfigureAuth$class.configure(Version.scala:352) ~[core_2.11.jar:0.4.4]
    at com.rethinkscala.net.Version3.configure(Version.scala:439) [core_2.11.jar:0.4.4]
    at com.rethinkscala.net.AbstractConnection$$anon$4.configure(Connection.scala:109) [core_2.11.jar:0.4.4]
    at com.rethinkscala.net.AbstractConnection$$anon$4.configure(Connection.scala:96) [core_2.11.jar:0.4.4]
Caused by: java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[na:1.7.0_60]
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[na:1.7.0_60]
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[na:1.7.0_60]
    at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[na:1.7.0_60]
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) ~[na:1.7.0_60]

I will continue to look into this error.

ohde commented 10 years ago

This is caused by: ERROR: this is the rdb protocol port (bad magic number) So I am looking at the compatibility of the driver with the db. Since I have not updated my database I will look at updating from 1.12 -> 1.13

ohde commented 10 years ago

Moving to new version has allowed me to use Version 3 and return results, however after results are returned it doesn't appear to be releasing it. Since, after so many requests I get no results returned. I will keep investigating.

kclay commented 10 years ago

Yeah Version 3 should work for 1.13+. And are you saying that after you query the connection isn't being released?

ohde commented 10 years ago

That is correct. I will write some Unit tests outside of my application for better testing/debugging of the issue at hand. However, all I have done is pulled and published the latest from your repo and in my application updated version2 -> version3, then updated to 1.13.4 of rethinkdb.

kclay commented 10 years ago

Great I'll test this out as well, I don't have any tests for the connection pool but I have an idea on why its not returning it.

ohde commented 10 years ago

I have confirmed this is an issue with the connection pool. As I have increased the max and now I am not getting the timeout issues as before when I run unit tests. Looking through implementation now in hopes of finding where the issue arises.

kclay commented 10 years ago

Sorry for the delay man been a crazy week. I'm working on reproducing this , let you know what I find. I'm wondering if you are getting any exceptions that are being hidden causing the connection to not return to the pool.

kclay commented 10 years ago

Ok test out 0.4.5-SNAPSHOT

ohde commented 10 years ago

No problem, today is the day I was going to take a look. I'm sorry I don't see any recent commits or releases in the repo.

necrodome commented 9 years ago

Are you going to release 0.4.5-SNAPSHOT?

kclay commented 9 years ago

@necrodome was released for 2.11 19days ago ,was waiting for confirmation from @maohde if it fixed his problem or not.

ohde commented 9 years ago

Crazy last few weeks. Works great, thanks.