Skip to content

Commit

Permalink
Merge branch 'sverker/dist-entry-bug-node-down' into maint
Browse files Browse the repository at this point in the history
OTP-18243
  • Loading branch information
sverker committed Sep 13, 2022
2 parents 6a0b2d0 + 84c87eb commit ab4584e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions erts/emulator/beam/dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ int erts_do_net_exits(DistEntry *dep, Eterm reason)
ASSERT(erts_atomic32_read_nob(&dep->qflgs) & ERTS_DE_QFLG_EXIT);
}
else {
ASSERT(dep->state == ERTS_DE_STATE_CONNECTED);
dep->state = ERTS_DE_STATE_EXITING;
erts_mtx_lock(&dep->qlock);
ASSERT(!(erts_atomic32_read_nob(&dep->qflgs) & ERTS_DE_QFLG_EXIT));
Expand Down Expand Up @@ -4987,25 +4988,29 @@ BIF_RETTYPE erts_internal_create_dist_channel_3(BIF_ALIST_3)
: dist_port_command);
ASSERT(dep->send);

/*
* Dist-ports do not use the "busy port message queue" functionality, but
* instead use "busy dist entry" functionality.
*/
{
ErlDrvSizeT disable = ERL_DRV_BUSY_MSGQ_DISABLED;
erl_drv_busy_msgq_limits(ERTS_Port2ErlDrvPort(pp), &disable, NULL);
}

conn_id = dep->connection_id;
set_res = setup_connection_epiloge_rwunlock(BIF_P, dep, BIF_ARG_2, flags,
creation, BIF_P->common.id,
net_kernel);
/* Dec of refc on net_kernel by setup_connection_epiloge_rwunlock() */
net_kernel = NULL;
if (set_res == 0)
if (set_res == 0) {
erts_atomic32_read_band_nob(&pp->state, ~ERTS_PORT_SFLG_DISTRIBUTION);
erts_prtsd_set(pp, ERTS_PRTSD_DIST_ENTRY, NULL);
erts_prtsd_set(pp, ERTS_PRTSD_CONN_ID, NULL);
goto badarg;
}
de_locked = 0;

/*
* Dist-ports do not use the "busy port message queue" functionality,
* but instead use "busy dist entry" functionality.
*/
{
ErlDrvSizeT disable = ERL_DRV_BUSY_MSGQ_DISABLED;
erl_drv_busy_msgq_limits(ERTS_Port2ErlDrvPort(pp), &disable, NULL);
}

hp = HAlloc(BIF_P, 3 + ERTS_DHANDLE_SIZE);
res = erts_build_dhandle(&hp, &BIF_P->off_heap, dep, conn_id);
res_tag = am_ok; /* Connection up */
Expand Down

0 comments on commit ab4584e

Please sign in to comment.