sile/jsone

badarg on probably valid term (encode)

AntonSizov opened this issue · 2 comments

erlang release: OTP17
erts:
jsone: 1054adc

input

T = [{formId,<<>>},{procId,<<83,54,68,68,70,85,82,78,55,67,50,49,79,76,67,66,67,74,49,79>>},{model,{[{<<112,114,111,99>>,<<111,107>>},{<<110,97,109,101>>,<<76,117,99,117,115>>},{<<105,115,65,117,116,104>>,<<116,114,117,101>>},{<<117,115,101,114,73,100>>,<<102,52,99,102,56,98,102,100,45,48,98,54,51,45,52,100,98,55,45,97,50,98,98,45,101,102,98,99,98,102,48,101,100,55,52,54>>}]}},{chatId,<<115,101,110,100,101,114>>},{class,<<46,103,101,116,85,115,101,114,73,110,102,111,46,115,101,110,100,101,114>>},{viewType,<<106,115,111,110>>},{viewModel,{[]}},{linkId,<<57,101,100,100,98,98,101,100,45,49,99,49,56,45,56,49,55,101,45,48,97,57,51,45,101,97,99,101,49,100,48,48,51,101,55,56>>},{created,1425304575552},{packetId,<<57,101,100,100,98,98,101,100,45,49,99,49,56,45,56,49,55,101,45,48,97,57,51,45,101,97,99,101,49,100,48,48,51,101,55,56>>},{from,<<115,101,110,100,101,114>>},{companyId,<<115,101,110,100,101,114>>},{robotId,<<103,101,116,85,115,101,114,73,110,102,111>>},{status,<<110,101,119>>}]
jsone:encode(T)

Exception

Ranch listener dispatchConv had connection process started with cowboy_protocol:start_link/4 at <0.4789.0> exit with reason: {[{reason,badarg},{mfa,{conv_base_handler,handle,2}},{stacktrace,[{jsone_encode,escape_string,[<<".sender">>,[{object_members,[{viewType,<<"json">>},{viewModel,{[]}},{linkId,<<"9eddbbed-1c18-817e-0a93-eace1d003e78">>},{created,1425304575552},{packetId,<<"9eddbbed-1c18-817e-0a93-eace1d003e78">>},{from,<<"sender">>},{companyId,<<"sender">>},{robotId,<<"getUserInfo">>},{status,<<"new">>}]}],<<123,34,102,111,114,109,73,100,34,58,34,34,44,34,112,114,111,99,73,100,34,58,34,83,54,68,68,70,85,82,78,55,67,50,49,79,76,67,66,67,74,49,79,34,44,34,109,111,100,101,108,34,58,123,34,112,114,111,99,34,58,34,111,107,34,44,34,110,97,109,101,34,58,34,76,117,99,117,115,34,44,34,105,115,65,117,116,104,34,58,34,116,114,117,101,34,44,34,117,115,101,114,73,100,34,58,34,102,52,99,102,56,98,102,100,45,48,98,54,51,45,52,100,98,55,45,97,50,98,98,45,101,102,98,99,98,102,48,101,100,55,52,54,34,125,44,34,99,104,97,116,73,100,34,58,34,115,101,110,100,101,114,34,44,34,99,108,97,115,115,34,58,34,46,103,101,116,85,0,0,0,0,0,0,0>>],[{line,144}]}

I cant reproduce this issue with erl -pa deps/jsone/ebin and typing input as well as attaching to the target node where issue appeared and typing input there.

sile commented

hmm...
Indeed, it seems like a valid term.
Can you recompile jsone and other modules (ex. cowboy, ranch, etc) with non-HiPE mode and retry ?

sile commented

The issue will be closed because half a year has elapsed without any progress being made.
Please create a new issue if you need.