msantos / procket

Erlang interface to low level socket operations
http://blog.listincomprehension.com/search/label/procket
BSD 3-Clause "New" or "Revised" License
283 stars 80 forks source link

procket_mktmp #41

Open tduccuong opened 6 years ago

tduccuong commented 6 years ago

Hi, using version 0.9.2 I am randomly getting this error:

{function_clause,[{lists,nth,[1,[]],[{file,"lists.erl"},{line,170}]},{procket_mktmp,template,3,[{file,"_build/default/lib/procket/src/procket_mktmp.erl"},{line,63}]},{procket,make_unix_socket_path,1,[{file,"_build/default/lib/procket/src/procket.erl"},{line,357}]},{procket,open,2,[{file,"_build/default/..."},...]},...]}}},...}

An advice is much appreciated. Thanks a lot Cuong

msantos commented 6 years ago

Thank you for letting me know about this! Should be fixed in version 0.9.3.

tduccuong commented 6 years ago

Hi @msantos,

I think the patch did not cut it! I still get the same error:

{{function_clause,[{lists,nth,[1,[]],[{file,"lists.erl"},{line,170}]},{procket_mktmp,template,3,[{file,"_build/default/lib/procket/src/procket_mktmp.erl"},{line,63}]},{procket,make_unix_socket_path,1,[{file,"_build/default/lib/procket/src/procket.erl"},{line,357}]},{procket,open,2,[{file,"_build/default/lib/procket/src/procket.erl"},{line,313}]}

Some how the Chars is an empty list eventhough it is a constant!

Could you pls take another look?

Thanks a lot, Cuong

msantos commented 6 years ago

Weird! I may have messed something up!

Could you check you are using the latest version of the procket_mktmp module?

> procket_mktmp:module_info().
[{module,procket_mktmp},
...
 {attributes,[{vsn,[152993229612997397851889811591875413266]}]},
...
 {md5,<<115,25,108,153,174,225,51,100,148,115,34,225,63,
        78,69,18>>}]

The error we were seeing is a little obscure: it happens because lists:nth/2 is trying to access an element outside of the list:

> lists:nth(4, "abc").
** exception error: no function clause matching lists:nth(1,[]) (lists.erl, line 170)
tduccuong commented 6 years ago

hi,

here is the module info:

...
{vsn,[151734941919204720059147883669516481264]}]},
...
{md5,<<114,39,22,58,45,57,214,70,210,36,66,126,15,168,
        114,240>>}]
...

I have deleted all and rebuilt from beginning for both "master" and "v0.9.3" branches. But get that same above vsn.

msantos commented 6 years ago

That's version 0.9.2:

$ git checkout 0.9.2
$ rebar3 do clean, compile, shell
1> procket_mktmp:module_info().
...
 {attributes,[{vsn,[151734941919204720059147883669516481264]}]},
 {md5,<<114,39,22,58,45,57,214,70,210,36,66,126,15,168,
        114,240>>}]

Maybe you have another version of procket in your path. You can check by running:

code:which(procket_mktmp).