+1 vote

Hi,

I'm experiencing a weird issue with Godot 2.1.3 running on Ubuntu 17.04. In my project, I've got a big JSON file of about 4000 well-indented lines. I'm reading it using this function:

func load_json(file_path):
var d = {}
var file = File.new()
file.open(file_path, file.READ)
d.parse_json(file.get_as_text())
file.close()
return d

It works well and the file is read properly. However, just after the line file.get_as_text() the debugger gets broken. I can see this error in the console:

ERROR: put_packet: Condition ' p_buffer_size + 4 > temp_buffer.size() ' is true. returned: ERR_INVALID_PARAMETER
   At: core/io/packet_peer.cpp:220.
ERROR: _notification: Condition ' cmd.get_type() != Variant::STRING ' is true.
   At: editor/script_editor_debugger.cpp:970.

After this point, if I set a breakpoint I lose the ability of stepping forward or continue the execution. The buttons just stop responding. I tried the following things:

  1. Remove keys from the JSON file to see if it stops breaking the debugger at some point. And it does. This means that the size of the file has something to do with the issue.
  2. I tried to avoid the conversion from JSON to Dictionary by creating a Dictionary object straight away in a GDScript file and pasting the content of the JSON there. The behavior is exactly the same: the debugger keeps getting broken.
  3. Since I don't think is very convenient to use JSON files as a Data Base, I tried out this plugin: https://github.com/khairul169/gdsqlite but I just realized it doesn't work for Android. What a pity, it looked good.

Any suggestions?

Thanks in advance,
Samuel

in Engine by (29 points)
edited by

Looks like the implementation of this function uses a fixed-size array... not very good considering your use case, that fixed-size array is too small to temporarily contain your file. In my opinion such internal buffers should be dynamic. You should open an issue about it on Github.

Yeah looks like a bug to me as well. Will open an issue on Github, thanks for your response!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.