otp genserver and port program

Vinubalaji Gopal vinubalaji@REDACTED
Fri Oct 23 11:45:41 CEST 2009


Hi all,

I wrote a port program based on the design principles of
http://www.trapexit.org/Writing_an_Erlang_Port_using_OTP_Principles

The only difference is my program is a linked in driver and the linked
in driver connects to a C program. The C program returns a tuple
response. It works fine if only one client connects to the server (I
get a proper response). But in case multiple client connects to the
server I get a bad match error and the gen_server terminates :(. The
debug message is not that useful and googling didn't give me anything
useful. I am using port_command to send the message to the linked in
driver (which is part of the handle_call). Is there any way to debug a
gen_server crashing (I don't get anything other than the badmatch
which I don't understand) and would gen_server handle_call not handle
multiple calls that are received simultaneously? It works fine if I
remove the port_command and just return random tuples.

The error I get looks something like this:
{{badmatch,^M
               {'$gen_call',^M
                   {<0.189.0>,#Ref<0.0.0.1057>},^M
{my_function,^M
                       Msg}}}

I would really appreciate any kind of help or pointers - have been
trying to debug this for a while and can't get much information :(.

-- 
Vinu

In a world without fences who needs Gates?


More information about the erlang-questions mailing list