-
Notifications
You must be signed in to change notification settings - Fork 150
Session Expiring and giving an error #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See #187 (comment) |
I have updated code their should I update the code here too. |
@Prateek218 I went through your code and have couple suggestions:
session
.run('match (c:channel) where c.from="yt" return c')
.then(function (result) {
session.close(); // <<-- session is closed here
return result.records.map(function (record) {
return {
title: record._fields[0].properties.channelid
};
})
})
...
session.run('match (a:video), (b:language) where a.language=b.title merge (b)-[r:video_lang{title:"video_lang"}]-(a) return a,b,r ') and before: session.run('match (a:channel), (b:video) where a.channelid={channelParam} AND b.source={channelParam} merge (a)-[r:rel_video{title:"yt"}]->(b) return a,b,r',{channelParam:cron_channel[k].title}) Also what driver and database versions are you using? Please let us know if those suggestions help. |
Database version is 3.1.1 and driver version is var neo4j = require('neo4j-driver').v1; var db = new neo4j_match.GraphDatabase('http://neo4j:neo4j@localhost:7474'); |
@Prateek218 do you use npm? could you share |
@lutovich Thank you for the help now my issue is resolved. package.json
|
But in sometimes it gives an error and the server keeps on running.
and Sometimes this error is generated and server stops
Database log
|
@Prateek218 I can see you use
|
yes in
right now I m running my code locally |
This stacktrace if for connection that was closed by driver. Database in such cases will print smth like this. There might be messages saying that database will close connection because of some error (like failed auth, etc.). |
ok, I will see to it and get back to you. |
I have the exact same issue. I'm using transaction and on every request, I'm committing or rollbacking the transaction, then I'm closing the session. But, sometimes I get this error Here my package.json: "dependencies": {
"aws-sdk": "^2.28.0",
"bcrypt": "^1.0.2",
"dataloader": "^1.2.0",
"file-type": "^4.1.0",
"graphql": "^0.9.1",
"graphql-server-hapi": "^0.7.1",
"graphql-tools": "^0.11.0",
"graphql-type-json": "^0.1.4",
"hapi": "^16.1.0",
"ioredis": "^2.5.0",
"jsonwebtoken": "^7.1.7",
"lodash": "^4.13.1",
"moment": "^2.18.1",
"neo4j-driver": "^1.2.0",
"request": "^2.79.0",
"request-promise": "^4.1.1",
"sendgrid": "^5.0.0",
"validate.js": "^0.11.1",
"vision": "^4.1.1"
} |
@lutovich Now when I'm running my code then sometimes I'm getting these error. In Database log
node log
and sometime it give different error when i run code like this below
and while running code this error is also generated in between and server keep on running and server stops when above error generated.
|
Hi @lutovich,
and on Database log same error is generated as I have already mentioned above. |
@Prateek218 I got this one sometimes too. I worked on a large app, and this issue happens in every environment (local, dev, staging, prod). I'm using a query builder which takes care to close transaction and session on every request. That's why I'm pretty sure it's not due to my code but the issue comes from the driver itself. |
@Aurelsicoko ok, then you can ask to @lutovich he will help you as I'm new to neo4j and as well as node. |
Hi @lutovich and @Aurelsicoko, |
Hi @Prateek218, You can use Cypher's SKIP and LIMIT to do pagination. Hope this helps. |
@Prateek218, @Aurelsicoko could you please try to set neo4j.driver(
"bolt://server:port",
neo4j.auth.basic("user", "password"),
{connectionPoolSize: 0}
) I think if errors go away this might mean something (load balancer, etc.) in the environment is killing idle connections. The we'd need to add ping or connection liveness check to the connection pool. Looking forward to your reply! |
But I'm using another neo4j driver.
can you tell me how to set {connectionPollSize: 0} in this driver which I'm using currently. |
@Prateek218 your code is not using this driver. It uses So
@Aurelsicoko do you think you could try setting connection pool size to zero? |
Closing because of inactivity. Please update the issue if the problem still exists. |
@lutovich Sorry for the lack of response, I forgot to keep you up-to-date. We handled the issue by re-sending the request when it failed. I'm no longer working on this project so I can't tell you if |
@Aurelsicoko thank you for the update. Setting connection pool size to zero was suggested in order to verify if the driver is forcing the database to handle too many connections and fail with OOM. It is not really a fix. I think this fix for neo4j might be relevant. It will be available in neo4j 3.4.0 soon (currently available in release candidate builds). |
I' m trying to solve this issue from 2 dyas, but not getting any solution.
Database log
2017-05-18 16:09:16.849+0000 ERROR [o.n.b.t.SocketTransportHandler] Fatal error occurred when handling a client connection: failed to allocate 16777216 byte(s) of direct memory (used: 922746887, max: 934281216) failed to allocate 16777216 byte(s) of direct memory (used: 922746887, max: 934281216)
io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 922746887, max: 934281216)
at io.netty.util.internal.PlatformDependent.incrementMemoryCounter(PlatformDependent.java:624)
at io.netty.util.internal.PlatformDependent.allocateDirectNoCleaner(PlatformDependent.java:578)
at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:709)
at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:698)
at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:237)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:221)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:141)
at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:262)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:170)
at io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:107)
at io.netty.handler.ssl.SslHandler.allocate(SslHandler.java:1472)
at io.netty.handler.ssl.SslHandler.allocateOutNetBuf(SslHandler.java:1482)
at io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:519)
at io.netty.handler.ssl.SslHandler.flush(SslHandler.java:490)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:787)
at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:779)
at io.netty.channel.AbstractChannelHandlerContext.access$1500(AbstractChannelHandlerContext.java:39)
at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:1148)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:1089)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Unknown Source)
2017-05-18 16:09:16.937+0000 WARN [io.netty.channel.AbstractChannelHandlerContext] Failed to mark a promise as failure because it has succeeded already: DefaultChannelPromise@3c0b7552(success)
server log
{ Error: Connection was closed by server
at Neo4jError.Error (native)
at new Neo4jError (C:\Users\Prateek\Desktop\Youtube Cron\node_modules\neo4j-driver\lib\v1\error.js:76:132)
at newError (C:\Users\Prateek\Desktop\Youtube Cron\node_modules\neo4j-driver\lib\v1\error.js:66:10)
at NodeChannel._handleConnectionTerminated (C:\Users\Prateek\Desktop\Youtube Cron\node_modules\neo4j-driver\lib\v1\internal\ch-node.js:336:41)
at emitNone (events.js:91:20)
at TLSSocket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ServiceUnavailable' }
The text was updated successfully, but these errors were encountered: