[erlang-bugs] More HiPE issues with binaries

Loïc Hoguin <>
Mon Mar 4 22:57:12 CET 2013

On 03/03/2013 03:16 PM, Kostis Sagonas wrote:
> On 03/02/2013 09:17 PM, Loïc Hoguin wrote:
>> Hello,
>> Cowboy doesn't work when compiled with HiPE. When using curl on a simple
>> hello world example, it sometimes work as expected, sometimes return a
>> 408 timeout error. When using http_load
>> (http://acme.com/software/http_load/) on the same example, it sometimes
>> work and sometimes throws a weird function_clause error.
>> ...
>> Here are the steps to reproduce. Sorry it's not the smallest download, I
>> can't isolate:
> OK, I've spent two hours on this and was able to minimize down to file
> cowboy_protocol.erl, which seems to be responsible for the behavior you
> are reporting. With this file compiled to BEAM byte code and everything
> else compiled to native code, cowboy seems to be working fine on my
> tests. Can you please confirm?


> If this file is the problematic one, perhaps you can disable native code
> compilation just for it for the time being. Also, it would help me if

I'm not using native, it was just an experiment. I would like to make it 
work for future users though.

> you trace all the calls to its functions and check whether their returns
> differ between byte code and native code execution.

We're investigating.

While doing so I found that erlang:display(binary_to_list(Buffer)) 
didn't work as expected (with just cowboy_protocol natively compiled). 
Perhaps you can add that to your todo list. io:format works fine but 
seems to reduce the probability that the bug happens (as does calling gc 

> I will look more into it when I find some time...

No worries. It's mostly just an interesting bug, I'm looking into it on 
my spare time too.

Thanks for the pointers.

Loïc Hoguin
Erlang Cowboy
Nine Nines

More information about the erlang-bugs mailing list