neo4j-contrib / java-rest-binding

Java Bindings for the Neo4J Server REST API, providing an implementation of GraphDatabaseService
Other
120 stars 72 forks source link

cannot process big batch > 8k #25

Closed vasil-yordanov closed 11 years ago

vasil-yordanov commented 12 years ago

Hello, I found the following bug in your library. https://github.com/neo4j/java-rest-binding/blob/1.8.RC1/src/main/java/org/neo4j/rest/graphdb/ExecutingRestRequest.java private InputStream toInputStream(Object data) { try { if (data instanceof InputStream) return (InputStream) data; PipedInputStream inputStream = new PipedInputStream(8 * 1024); PipedOutputStream outputStream = new PipedOutputStream(inputStream); StreamJsonHelper.writeJsonTo(data, outputStream); return inputStream; } catch (IOException e) { throw new RuntimeException("Error writing "+data+" to stream",e); } } Here you have buffer of 8kB: new PipedInputStream(8 * 1024); But when I have big json request s your library hangs on: the following code:

https://github.com/neo4j/java-rest-binding/blob/1.8.RC1/src/main/java/org/neo4j/rest/graphdb/util/StreamJsonHelper.java public static void writeJsonTo( Object data , OutputStream stream) { try { JsonGenerator generator = OBJECT_MAPPER.getJsonFactory() .createJsonGenerator(stream); OBJECT_MAPPER.writeValue(generator, data); stream.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } }

Here the code block on this line: OBJECT_MAPPER.writeValue(generator, data); The problem actually is that when you try to write big data (more than 8kB) to the outputStream , then the code hangs.

Please provide the fix for this issue, because your library is not able to process big messages.

Regards,

Vasil Yordanov

vasil.yordanov@gmail.com

vasil-yordanov commented 12 years ago

Hi Sorry, I just saw that you have a fix for this issue.

vasil-yordanov commented 12 years ago

Where I can get some build including the change?