Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/5.0' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
spoonincode committed Jan 31, 2024
2 parents e5d45ce + b010e7e commit 0fe4602
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/chain/webassembly/runtimes/eos-vm-oc/ipc_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ static constexpr size_t max_message_size = 8192;
static constexpr size_t max_num_fds = 4;

std::tuple<bool, eosvmoc_message, std::vector<wrapped_fd>> read_message_with_fds(boost::asio::local::datagram_protocol::socket& s) {
// read_message_with_fds() is intended to be blocking, and sockets it is used with are never explicitly set to non-blocking mode.
// But when doing an async_wait() on an asio socket, asio will set the underlying file descriptor to non-blocking mode.
// It's not clear why, but in some cases after async_wait() indicates readiness, a recvmsg() on the socket can fail with
// EAGAIN if the file descriptor is still in non-blocking mode (as asio had set it to).
// Always set the file descriptor to blocking mode before performing the recvmsg()
boost::system::error_code ec;
s.native_non_blocking(false, ec);
if(ec)
wlog("Failed to set socket's native blocking mode");

return read_message_with_fds(s.native_handle());
}

Expand Down

0 comments on commit 0fe4602

Please sign in to comment.