[erlang-questions] erlang:setnode/3 and sctp

Steve Vinoski <>
Tue Jan 26 04:08:13 CET 2016

On Mon, Jan 25, 2016 at 8:46 PM, Tristan Sloughter <> wrote:

> So the reason I was figuring out SCTP in my last email was I thought
> it'd be interesting to play around with creating a SCTP Erlang
> distribution option.
> The problem I've been stuck on and completely lost in is the use of
> erlang:setnode/3 in dist_util. I discovered that do_setnode/1 in
> dist_util is failing on setnode with:
> {badarg,[{erlang,setnode,[,#Port<0.755>,{229373,5,'',''}],[]},
>                {dist_util,do_setnode,1,
>                           [{file,"src/dist_util.erl"},{line,415}]},
>                {dist_util,connection,1,
>                           [{file,"src/dist_util.erl"},{line,347}]}]}
> The only thing I can speculate is that there is something it doesn't
> like about the Port or some setup I'm missing that leads up to this call
> because there are multiple places it could be throwing that badarg and
> what is going on in dist.c is not clear to me aside from the very basics
> :)
> https://github.com/erlang/otp/blob/maint/erts/emulator/beam/dist.c#L2699-L2866
> If anyone has experience and knows what setnode is doing and why it
> might be failing it would be much appreciated :)
> The non-working code is up here https://github.com/tsloughter/sctp_dist

One of the sources of a badarg in that function is if the port driver
doesn't set the ERL_DRV_FLAG_SOFT_BUSY flag (see
http://erlang.org/doc/man/driver_entry.html#driver_flags). The SCTP driver
doesn't set this, so in the link to the code you sent, I'm guessing it
fails here:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160125/6db36403/attachment.html>

More information about the erlang-questions mailing list