Closed djole1973 closed 5 years ago
CC @Faless
I confirm websocket error using LudiDorici module, I also have this error in Firefox (Win10).
I tested multiple websocket servers (echo.websocket.org, my 2 servers in ws and wss).
Same error in both browsers:
**ERROR**: Condition ' p_payload && _payload.space_left() < p_size ' is true. returned: ERR_OUT_OF_MEMORY
At: modules/websocket/packet_buffer.h:62:write_packet() - Condition ' p_payload && _payload.space_left() < p_size ' is true. returned: ERR_OUT_OF_MEMORY
on Godot 3.1.alpha.calinou.404f394
with websocket module
Using Chrome Websockets Client Extension, I can connect to local (windows) server but messages are not going through either ways.
It only works fine in native (windows) server to any client (but HTML5).
When browser tries ws://127.0.0.1:8000, it throws:
Connecting to host: ws:/127.0.0.1:8000 Client Websocket Chat Demo.js:7:54153
SecurityError: The operation is insecure.
@djole1973 thank you for reporting this issue!
The extra 5 bytes in the payload was removed in that PR, so the check is fine, however I found out that the ProjectSettings option specifying the buffer sizes was read incorrectly in the JS implementation, resulting in buffers being too small to receive any packet.
This should be fixed in #24610, if you have the time to test it out it would be very helpful. Thanks.
It's not my ticket, but I tried today with Windows nightly build Godot 3.1.alpha.calinou.a366d45 and still receive:
Client Websocket Chat Demo.js:7 **ERROR**: Condition ' p_payload && _payload.space_left() < p_size ' is true. returned: ERR_OUT_OF_MEMORY
put_char @ Client Websocket Chat Demo.js:7
write @ Client Websocket Chat Demo.js:7
write @ Client Websocket Chat Demo.js:7
doWritev @ Client Websocket Chat Demo.js:7
___syscall146 @ Client Websocket Chat Demo.js:7
___stdio_write
_vfprintf
__ZN9StdLogger4logvEPKcPib
__ZN6Logger10logf_errorEPKcz
__ZN6Logger9log_errorEPKcS1_iS1_S1_NS_9ErrorTypeE
__ZN15CompositeLogger9log_errorEPKcS1_iS1_S1_N6Logger9ErrorTypeE
__ZN2OS11print_errorEPKcS1_iS1_S1_N6Logger9ErrorTypeE
__Z16_err_print_errorPKcS0_iS0_16ErrorHandlerType
__ZN12PacketBufferIhE12write_packetEPKhjS2_
__ZN8EMWSPeer8read_msgEPhjb
__esws_on_message
(anonymous) @ Client Websocket Chat Demo.js:7
ccall @ Client Websocket Chat Demo.js:7
(anonymous) @ Client Websocket Chat Demo.js:7
Client Websocket Chat Demo.js:7 At: modules/websocket/packet_buffer.h:62:write_packet() - Condition ' p_payload && _payload.space_left() < p_size ' is true. returned: ERR_OUT_OF_MEMORY
I run http-server (npm) locally to access the html export.
@j2l pardon me for asking, but did you make sure to also update your export templates?
Thanks @Faless for pointing me in the right direction, indeed, I didn't update them. Now I've done it, but it still throws the error. I removed local http-server by using github. Here's the repo of this export. To track server's error, I also published it on glitch.
@j2l I suspect your local config is still the culprit. Either you didn't update the export templates correctly, or you didn't re-export, or re-export to a different location without realizing. I just exported using the nightly build from Calinou, windows editor, with the right export template, and it works like a charm. export.zip
I confirm yours is working fine indeed.
Weird, I went into AppData/Roaming/Godot/templates/
and deleted the 3.1.alpha
folder then re-imported it from Godot Engine 3.1
I also deleted the HTML5 preset and changed the path to new created html/ just to make sure nothing was coming from previous version.
Or ... is it using the 3.0.6 stable
template?
Making a diff between the 2 folders, it doesn't see any change except for version.txt!
Where did you get your 3.1 template from?
then re-imported it from Godot Engine 3.1
You are using the templates without the fix.
You obviously must use the export template from the same nightly repository when using nightly version: https://archive.hugo.pro/builds/godot/templates/godot-templates-android-html5-linux-windows-nightly.tpz
Where did you get your 3.1 template from?
From the same page you linked with the nightly build: https://hugo.pro/projects/godot-builds/
You obviously must use the export template from the same nightly repository when using nightly version:
Yep, I understand my mistake now. It's working with the nightly template. Thanks Fabio
Godot version: v3.1 alpha3
OS/device including version: HTML5, Chrome
Issue description: It seems root cause of the problem is commit: c066db4d59d3c39de59062ddb24e473aa2c2a7b8 Fabio Alessandrelli 03/11/2018 04:46:38 +00:00 Convert WebSocket module to use PacketBuffer class.
Method: Error EMWSPeer::read_msg(uint8_t *p_data, uint32_t p_size, bool p_is_string) {
} And in the older version code snippet is not ported correctly(missing p_size + 5 checking) : if (in_buffer.space_left() < p_size + 5) { ERR_EXPLAIN("Buffer full! Dropping data"); ERR_FAIL(); }
Steps to reproduce: On WebSocket packet receive, ERROR message appear.
Diamonds ITS.js:7 ERROR: Condition ' p_payload && _payload.space_left() < p_size ' is true. returned: ERR_OUT_OF_MEMORY put_char @ Diamonds ITS.js:7 write @ Diamonds ITS.js:7 write @ Diamonds ITS.js:7 doWritev @ Diamonds ITS.js:7 (anonymous) @ Diamonds ITS.js:7 ccall @ Diamonds ITS.js:7 (anonymous) @ Diamonds ITS.js:7 Diamonds ITS.js:7 At: modules/websocket/packet_buffer.h:62:write_packet() - Condition ' p_payload && _payload.space_left() < p_size ' is true. returned: ERR_OUT_OF_MEMORY
Minimal reproduction project: