<div dir="ltr">Embarrasingly enough I simply allocated a too small buffer in my C program. I based my code on <div><a href="http://erlangcentral.org/wiki/index.php?title=How_to_use_ei_to_marshal_binary_terms_in_port_programs">http://erlangcentral.org/wiki/index.php?title=How_to_use_ei_to_marshal_binary_terms_in_port_programs</a><br></div><div>which allocated a 128 byte sized buffer for the messages. Increasing this size solved this problem. Not entirely sure why though as the code seems to realloc the buffer if the size is larger then the previously allocated buffer but I should be able to figure it out though.</div><div><br></div><div>/axling</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 11, 2014 at 7:43 AM, Erik Axling <span dir="ltr"><<a href="mailto:axling@gmail.com" target="_blank">axling@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Ok. I'll see if I can narrow it down some more. Thanks for checking this case at least. <br><br>/axling</div><div><br>11 dec 2014 kl. 01:45 skrev Björn-Egil Dahlberg <<a href="mailto:wallentin.dahlberg@gmail.com" target="_blank">wallentin.dahlberg@gmail.com</a>>:<br><br></div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr">I think something else is going here.<div><br></div><div>Just to be sure, I added your specific example to erl_interface tests and that passed without problems.</div><div><br></div><div><span style="font-size:13px">If ei_decode_version(but, &index, &version) fails, that typically means you have corrupted your binary somewhere.</span><br></div><div><span style="font-size:13px">ei_decode_version checks if the leading byte of the binary is 131 (the current version).</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">// Björn-Egil</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-11 0:18 GMT+01:00 Erik Axling <span dir="ltr"><<a href="mailto:axling@gmail.com" target="_blank">axling@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello!<div><br></div><div>I ran into an issue where ei_decode_version seems to fail when trying to decode a term that contains a map with large atom keys.</div><div><br></div><div>My message that is sent to the port looks something like this:</div><div><br></div><div>erlang:port_command(Port, term_to_binary({cmd, type, undefined, #{asdadasdsadasdasdasdasda=>sadsadsada,asdsadsadsadsadsadsadasdasdsadasb=>sdsdsdsdsdb})).</div><div><br></div><div>This fails in my port pretty quickly when doing ei_decode_version(but, &index, &version).</div><div><br></div><div>It works when i send a message similar to</div><div><br></div><div>erlang:port_command(Port, term_to_binary({cmd, type, undefined, #{b=>s, a=>s})).<br></div><div><br></div><div>Erlang version is :</div><div><div>Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]</div><div><br></div><div>Eshell V6.2 (abort with ^G)</div></div><div><br></div><div>Running this on a Macbook Air if that is interesting.</div><div><br></div><div><br></div><div>I know that the maps feature is still a bit experimental so just would like to know if this is a known issue of if I'm understanding something wrong?</div><span><font color="#888888"><div><br></div><div>/axling </div></font></span></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>