Closed tselishev-semen closed 9 years ago
Hi! Thanks for using :)
Unexpected end-of-input in VALUE_STRING
I think the data source has been trimmed by some kind of limit, please check it. Anyway netty-socketio receives a half of string, i think.
was not called before it's garbage-collected.
try to allocate more memory to your server
Thank you for the quick response. But that's not all :) 2 How to run the server as a daemon I'm used https://github.com/mrniko/netty-socketio-demo and I found a solution:
mvn exec:java
ctrl+z
disown - h
bg 1
Maybe there is a better solution?
3 I tried to upgrade to version 1.7.5. But my code is not working correctly. Where you can read what has changed?) and sorry for my english)
2 How to run the server as a daemon
mvn exec:java .... &
try to add &
to run it in background
3 I tried to upgrade to version 1.7.5
change list is always available in readme.md file
try to add & to run it in background
It worked, thanks) How i can reboot server?
I think the data source has been trimmed by some kind of limit, please check it. Anyway netty-socketio receives a half of string, i think.
Before I added:
config.setMaxFramePayloadLength(10000000);
config.setMaxHttpContentLength(10000000);
was an error:
Max frame length of 65536 has been exceeded.
I think maybe data truncated, when the nginx passes the data to the websoket server
//nginx.conf
location /socket
{
proxy_pass http://192.168.0.34:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
I'll check it out
try to allocate more memory to your server
4GB of memory on the server. This is not enough?
How i can reboot server?
Usually you need to wrap your server in some kind of application and run it via service or with some app-container. All functionality (i mean .start and .stop methods) are provided by my lib.
4GB of memory on the server. This is not enough?
May be it's your case? http://stackoverflow.com/questions/22563167/netty-bytebuf-dont-get-the-full-message-of-a-large-input-when-decoding
I think maybe data truncated, when the nginx passes the data to the websoket server
Try to reproduce this problem without nginx first
Also try to set Config.tcpReceiveBufferSize
setting
try to add & to run it in background
When I close the terminal, the process is terminated too.This is not what I wanted :)
Usually you need to wrap your server in some kind of application and run it via service or with some app-container. All functionality (i mean .start and .stop methods) are provided by my lib.
Looks, like I need more knowledge about linux:). Thanks.
Try to reproduce this problem without nginx first
I will raise test server, where the websocket server will run without nginx. Then write about the results:)
| 2 How to run the server as a daemon Have you tried Procrun (for Windows)? It wraps a Java application into a Windows service that you can control (start/stop/etc) from the Windows Services control app. We use it with vey good results.
Have you tried Procrun (for Windows)? It wraps a Java application into a Windows service that you can control (start/stop/etc) from the Windows Services control app. We use it with vey good results.
I only have a linux:) Any solution for linux(centos)? I am not yet a java developer and I will be glad of any help:)
mrniko, Вы же с Москвы) по русски мб лучше?
Try to reproduce this problem without nginx first
Without a nginx problem still occurs.
mrniko, Вы же с Москвы) по русски мб лучше?
it's better on english, because other users can join too in this case
Also try to set Config.tcpReceiveBufferSize setting. did you tried to change this setting?
Also try to set Config.tcpReceiveBufferSize setting. did you tried to change this setting?
I added:
Configuration config = new Configuration();
SocketConfig socketConfig = new SocketConfig();
socketConfig.setTcpReceiveBufferSize(20);
config.setSocketConfig(socketConfig);
//another settings ...
final SocketIOServer server = new SocketIOServer(config);
result: 1) error does not appear 2) But the file(Blob) is not uploaded
What value of the attribute(tcpReceiveBufferSize ) to use? For example, to upload 1 mb.
try to set setTcpReceiveBufferSize=10000000
try to set setTcpReceiveBufferSize=10000000
error Unexpected end-of-input in VALUE_STRING appeared again :)
at [Source: io.netty.buffer.ByteBufInputStream@25f5445b; line: 1, column
: 129893]
and which value in column
now in error?
at [Source: io.netty.buffer.ByteBufInputStream@25f5445; line: 1, column: 129893] and which value in column now in error?
I do not know how to write this type of errors to a text file. In the terminal does not fit the full log :(
//other base64 data
cHVzaCgnXHJcbicpOwogICAgICAgIH0KCiAgICAgICAgcmV0dXJuIHJlc3VsdC5qb2luKCcnKTsKICAgIH0KCiAgICBmdW5jdGlvbiBwYXVzZShuKSB7CiAgICAgICAgdG9kYXkgPSBuZXcgRGF0ZSgpCiAgICAgICAgdG9kYXkyID0gdG9kYXkKICAgICAgICB3aGlsZSAoKHRvZGF5MiAtIHRvZGF5KSA8PSBuKSB7CiAgICAgICAgICAgIHRvZGF5MiA9IG5ldyBEYXRlKCkKICAgICAgICB9CiAgICB9CgogICAgdGhpcywgImV2ZW50cyIpIHx8IHt9KVthLnR5cGVdIHx8IFtdLCBrID0gbi5ldmVudC5zcGVjaWFsW2EudHlwZV0gfHwge307CiAgICBpZiAoaVswXSA9IGEsIGEuZGVsZWdhdGVUYXJnZXQgPSB0aGlzLCAhay5wcmVEaXNwYXRjaCB8fCBrLnByZURpc3BhdGNoLmNhbGwodGhpcywgYSkgIT09ICExKSB7CiAgICAgICAgaCA9IG4uZXZlbnQuaGFuZGxlcnMuY2FsbCh0aGlzLCBhLCBqKSwgYiA9IDA7CiAgICAgICAgd2hpbGUgKChmID0gaFtiKytdKSAmJiAhYS5pc1Byb3BhZ2F0aW9uU3RvcHBlZCgpKSB7CiAgICAgICAgICAgIGEuY3VycmVudFRhcmdldCA9IGYuZWxlbSwgYyA9IDA7CiAgICAgICAgICAgIHdoaWxlICgoZ for type: class com.corundumstudio.socketio.protocol.Event
com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input in VALUE_STRING
at [Source: io.netty.buffer.ByteBufInputStream@42709226; line: 1, column: 129981]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
....
I think, I found a bug. It looks like a bug in Google Chrome. In another browser (ff) everything(upload blob) works fine. I can not believe it :)
probably a bug in Chromium. Opera and Chrome do not work FF и IE work well
so setTcpReceiveBufferSize=10000000 helps to upload in FF and IE?
so setTcpReceiveBufferSize=10000000 helps to upload in FF and IE?
no. FF and IE work without setTcpReceiveBufferSize
https://code.google.com/p/chromium/issues/detail?id=420578 Probably, the Chrome sends the fragmented message(when message > 100kb?) and Websocket server does not know to handle them. What do you think? Problem may be in this?
as wrote in comments it's 128Kb limit. In your case the string has end at 129981 or 129981 byte, so i think it's really this issue.
Any idea how to fix it?
as i know netty supports websocket frame fragmentation by ContinuationWebSocketFrame
. Don't know which side is broken - chromium or netty.
as i know netty supports websocket frame fragmentation by ContinuationWebSocketFrame. Don't know which side is broken - chromium or netty.
If I replace the *WebSocketFrame classes in netty-socketio to ContinuationWebSocketFrame class, it can help?
1) I will try to use a different socket server (nodejs or php) 2) and try to write a working example for https://github.com/mrniko/netty-socketio-demo, which will appear this error
2) and try to write a working example for https://github.com/mrniko/netty-socketio-demo, which will appear this error
change fileChatLauncher
public class ChatLauncher {
public static void main(String[] args) throws InterruptedException {
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
config.setMaxFramePayloadLength(10000000);
config.setMaxHttpContentLength(10000000);
final SocketIOServer server = new SocketIOServer(config);
server.addEventListener("chatevent", ChatObject.class, new DataListener<ChatObject>() {
@Override
public void onData(SocketIOClient client, ChatObject data, AckRequest ackRequest) {
// broadcast messages to all clients
server.getBroadcastOperations().sendEvent("chatevent", data);
}
});
server.start();
Thread.sleep(Integer.MAX_VALUE);
server.stop();
}
}
To reproduce the error: 0) mvn exec:java 1) Open chrome 2) ctrl+shifr+i (open console) 3) execute code:
var str = 'sadsadsa1231231dfds;fdsfsdfsdfdsfdsf1121fadsfdsfsfssadsadasdsadasdsadas';
var i = 0;
var result = [];
while( i <10000){
i= i + 1 ;
result.push(str);
}
var message = btoa(result.join('dfadfdf'));
socket.emit('chatevent', {userName: 'sem', message: message });
4) Then you will see an my error in the terminal I tested it in version 1.7.3.
1) I will try to use a different socket server (nodejs or php)
I tried to run the same code on nodejs(http://socket.io/get-started/chat/). It worked perfectly.
var str = 'sadsadsa1231231dfds;fdsfsdfsdfdsfdsf1121fadsfdsfsfssadsadasdsadasdsadas';
var i = 0;
var result = [];
while( i <10000){
i= i + 1 ;
result.push(str);
}
var message = btoa(result.join('dfadfdf'));
socket.emit('chat message', message);
Result: there are no errors and message send
I found the cause of this issue. Will fix during a day
fixed
Hi. I use a framework(1.7.3 version) already some time and I have accumulated a number of issues:).
Client Side
Problem: when I upload a large file( ~150+kb ), the server generates an error
a) How can I fix this error? b) If several times to upload a large file (2mb) in different pages, server crashes:
How can I avoid it?