[erlang-questions] port_command returns badarg in long binary input

Frederick Grim frederick.grim@REDACTED
Thu Jan 29 17:09:41 CET 2009


so I'll answer my own question.  It turns out I was opening the port
with the option {packet, 2}.
the problem here is that if you then try and feed in a binary to
port_command that is greater in size then can be
encoded into the 2 byte header port_command fails with an unhelpful
badarg error.

Thanks all.
    Fred


Frederick Grim wrote:
> Hello List,
>     So I have been fighting with the following problem.  I have a port
> that I feed in data to and most of the time it works fine.  However for
> longer data of the form
>
> [ pipeline, { atom(), [ { atom(), string() }, { atom(), string() },...]}]
>
> it dies with the following error:
>
> =ERROR REPORT==== 28-Jan-2009::16:36:29 ===
> caught exception {badarg,[{erlang,port_command,
>                                   [#Port<0.102>,
>                                   
> <<131,108,0,0,0,1,100,0,5,114,101,115,101,
>                                      116,106>>]},
>                           {pipeline_bridge,send_msg,2},
>                           {pipeline_bridge,get_response,1},
>                           {pipeline_bridge,call_port,2},
>                           {pipeline_bridge,handle_call,3},
>                           {gen_server,handle_msg,5},
>                           {proc_lib,init_p,5}]}
> I have attached the pipeline_bridge.erl file.  I am sort of at a loss
> here.  The problem is entirely related to the size of the data.  The
> bigger it is, past some threshold I for sure get this sort of failure. 
> Could it be a character encoding issue?  The strings could, potentially,
> be some sort of non-ascii codec.  Thanks for the time.
>     Fred
>
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list