-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix _cannot recursively call into Core
_ issue
#10144
Conversation
Err(_) => return None, | ||
Ok(gateway_result) => gateway_result, | ||
}; | ||
match gateway_result { | ||
Err(ref err) => debug!("Gateway search error: {}", err), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not
match search_gateway_child.join().ok()? {
Err(e) => {}
Ok(g) => {}
}
@ngotchac I have seen this when I enable a lot of logs but I don't understand how the logs apply to this? Or do you think it is something else? |
@niklasad1 I think it's just a race-condition, so enabling logs might just slow down some parts of the start-up and raise this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
Can you remove the first commit which is confusing IMHO because it was removed in the in the second commit without any explanation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We only call it at startup so starting a thread shouldn't be bad.
* version: bump stable to 2.2.7 * version: mark 2.2 track stable * version: mark update critical on all networks * version: commit cargo lock * Ping nodes from discovery (#10167) * snap: fix path in script (#10157) * snap: fix path in script * debug, revert me * fix * necromancer awk magic * awk necromancy and path fixing * working track selection * Fix _cannot recursively call into `Core`_ issue (#10144) * Change igd to github:maufl/rust-igd * Run `igd::search_gateway_from_timeout` from own thread * Handle the case for contract creation on an empty but exist account with storage items (#10065) * Add is_base_storage_root_unchanged * Fix compile, use a shortcut for check, and remove ignored tests * Add a warn! * Update ethereum/tests to v6.0.0-beta.2 * grumble: use {:#x} instead of 0x{:x} Co-Authored-By: sorpaas <accounts@that.world> * version: bump fork blocks for kovan and foundation (#10186) * pull constantinople on ethereum network (#10189) * ethcore: pull constantinople on ethereum network * version: mark update as critical * ethcore: remove constantinople alltogether from chain spec * version: revert fork block for ethereum
* version: mark 2.3 track beta * version: mark update critical on all networks * Ping nodes from discovery (#10167) * Fix _cannot recursively call into `Core`_ issue (#10144) * Change igd to github:maufl/rust-igd * Run `igd::search_gateway_from_timeout` from own thread * Handle the case for contract creation on an empty but exist account with storage items (#10065) * Add is_base_storage_root_unchanged * Fix compile, use a shortcut for check, and remove ignored tests * Add a warn! * Update ethereum/tests to v6.0.0-beta.2 * grumble: use {:#x} instead of 0x{:x} Co-Authored-By: sorpaas <accounts@that.world> * version: bump fork blocks for kovan and foundation (#10186) * pull constantinople on ethereum network (#10189) * ethcore: pull constantinople on ethereum network * version: mark update as critical * ethcore: remove constantinople alltogether from chain spec * version: revert fork block for ethereum
* version: bump beta to 2.3.1 * Fix _cannot recursively call into `Core`_ issue (#10144) * Change igd to github:maufl/rust-igd * Run `igd::search_gateway_from_timeout` from own thread * Update for Android cross-compilation. (#10180) * build-unix update * .gitlab-ci update * Update build-unix.sh add android postprocessing * path to android lib libparity.so * fix path to libparity * add android lib to artifacts * Run all `igd` methods in its own thread (#10195) * Cancel Constantinople HF on POA Core (#10198) * Add EIP-1283 disable transition (#10214) * Enable St-Peters-Fork ("Constantinople Fix") (#10223) * ethcore: disable eip-1283 on kovan block 10255201 * ethcore: disable eip-1283 on ropsten block 4939394 * ethcore: enable st-peters-fork on mainnet block 7280000 * ethcore: fix kovan chain spec * version: update fork blocks * ethcore: disable eip-1283 on sokol block 7026400
It seems that on latest
master
, Parity would sometimes crash withThread 'IO Worker #2' panicked at 'cannot recursively call into "Core"', libcore/option.rs:1008
.This is because we use
https://github.com/sbstp/rust-igd
methodsearch_gateway_from_timeout
which callsget_control_url
which runs a future in a new tokio Core, while we call this method already from a running tokio Core.https://github.com/sbstp/rust-igd/blob/df53f419eec3684eec4bf0f45003cff1c4933682/src/search.rs#L101-L105
Moving to this fork and branch https://github.com/maufl/rust-igd/tree/update-hyper solves the issue ; maybe we should have our own fork?Instead of using another fork, I found that the easiest way to fix this is actually to run
igd::search_gateway_from_timeout
in a separate thread, where we are sure tokio won't be already running.To test that this work, one can apply this diff patch:
The inherant issue is that
future::loop_fn
first calls the closure, so if the message to runinit_public_interface
(which callsigd::search_gateway_from_timeout
) is already in the queue when setting up the workers, it would run just fine sincetokio::runtime::current_thread::block_on_all
hasn't been called yet ; this happens in most cases since it's the first message sent to the IoService. It could happen that it isn't, resulting ininit_public_interface
being called in a Tokio context, crashingparity-ethereum
.With this patch, the first call to the future's closure won't wait for a message, resulting in every message being called in a Tokio context. So if one applies this patch on
master
, it should crash the app at every single run.