Skip to content

Commit 03dcfa5

Browse files
committed
Merge pull request #1466 from pguyot/w02/fix-deadlock-in-sockets
Fix deadlock in socket code Fix a deadlock that was introduced in 555745c and that happens on platforms without recursive locks (e.g. esp32) by removing an unnessary lock in `socket_recv`. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 23b0781 + 263c831 commit 03dcfa5

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/libAtomVM/otp_socket.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,9 +1910,7 @@ static ssize_t do_socket_recv(struct SocketResource *rsrc_obj, uint8_t *buf, siz
19101910

19111911
ssize_t socket_recv(struct SocketResource *rsrc_obj, uint8_t *buf, size_t len, int flags, term *from, Heap *heap)
19121912
{
1913-
SMP_RWLOCK_RDLOCK(rsrc_obj->socket_lock);
19141913
ssize_t result = do_socket_recv(rsrc_obj, buf, len, flags, from, heap);
1915-
SMP_RWLOCK_UNLOCK(rsrc_obj->socket_lock);
19161914
return result;
19171915
}
19181916

0 commit comments

Comments
 (0)