Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Use local parity-dapps-glue instead of crate published at crates.io #8983

Merged
merged 2 commits into from
Jun 26, 2018

Conversation

sorpaas
Copy link
Collaborator

@sorpaas sorpaas commented Jun 26, 2018

No description provided.

@sorpaas sorpaas added A0-pleasereview 🤓 Pull request needs code review. M8-dapp 💎 Decentralized applications. labels Jun 26, 2018
@sorpaas sorpaas added this to the 1.12 milestone Jun 26, 2018
@5chdn 5chdn added P2-asap 🌊 No need to stop dead in your tracks, however issue should be addressed as soon as possible. M5-dependencies 🖇 Dependencies. labels Jun 26, 2018
@5chdn
Copy link
Contributor

5chdn commented Jun 26, 2018

Does this only affect master?

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jun 26, 2018

@5chdn We still need to wait for the CI to complete to know whether this is the cause of the problem. (And this change fixes a dependency issue regardless whether it's the cause of the CI failures.)

If so, then I think it's due to cargo/rust update, specifically, a problem for querying doctest dep versions. It probably affects every build using Rust 1.27. (But there's still a chance that this may not be what caused the CI failures and I might be wrong here.)

@ordian
Copy link
Collaborator

ordian commented Jun 26, 2018

I'm not sure whether this change can fix build issue, since all the commits to js-glue (#8666, #8791, #7355) after 1.9.1 was published, should not have affected default build.

Copy link
Collaborator

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it, I believe it actually fixes the build w/o cargo clean, because IIUC cargo caches git dependencies in $HOME/.cargo/registry which cargo clean doesn't remove (rust-lang/cargo#3289). And switching to path dependency invalidates this cache.

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jun 26, 2018

Ah right. Then I guess this needs to wait for cache cleanup right now. I'm going to reset to HEAD^.

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jun 26, 2018

I figured out this might not be the cache issue. I cleared up ~/.cargo and run ./test.sh locally, but it still fails with the panic strategy error.

@sorpaas sorpaas added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jun 26, 2018
@sorpaas
Copy link
Collaborator Author

sorpaas commented Jun 26, 2018

Are there any more benefits to use panic=abort rather than binary size? I found out that it is introduced in #3423, and we had around 2mb binary gains, which, given our current binary size, doesn't look significant any more. It looks like we're one of the main project that suffers from the panic strategy error (searching google about this shows mostly parity repo on the front page). Would we consider to drop panic=abort?

I also noticed that lto optimization is disabled for profile.release, and it's introduced in #499. I didn't find explanations for this, however. Just curious, are there any particular reasons we are having this settings?

cc @arkpar

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jun 26, 2018

Local testing worked for me. I'm going to push the commit that disables panic=abort and enable lto optimization, just to see how it works. Looks like this also has positive effect in incremental build.

@sorpaas sorpaas added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Jun 26, 2018
@ordian
Copy link
Collaborator

ordian commented Jun 26, 2018

This is really strange, what command is failing? Is it cargo test --features "json-tests" --all --release? Because it works for me locally.

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jun 26, 2018

@ordian I ran ./test.sh. Without commit 8023e35, it emits the same "... the panic strategy abort which is incompatible with this crate's strategy of unwind ..." error message. Removing panic=abort fixes the issue.

My opinion on this is that panic=abort is probably not mature enough on Rust yet. While aborting saves some binary size and compile time, unwinding allows possibly more control for how the program panics (ref https://users.rust-lang.org/t/panic-unwind-vs-abort/9928). There're also other projects, like ripgrep (BurntSushi/ripgrep@d5c0454) took the same reversion.

Copy link
Collaborator

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is ./test.sh works fine for me, so I'm not sure what the right solution is.


[profile.release]
debug = false
lto = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid with lto enabled build machines can ran out of memory.

Copy link
Collaborator

@debris debris Jun 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the documentation lto = false is the default for [profile.release], so this changes nothing

@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jun 26, 2018
@debris debris merged commit c0b0dc5 into master Jun 26, 2018
@debris debris deleted the sorpaas/js-glue branch June 26, 2018 15:37
5chdn pushed a commit that referenced this pull request Jun 26, 2018
…8983)

* Use local parity-dapps-glue instead of crate published at crates.io

* Disable panic=abort and enable lto optimization
This was referenced Jun 26, 2018
5chdn pushed a commit that referenced this pull request Jun 26, 2018
…8983)

* Use local parity-dapps-glue instead of crate published at crates.io

* Disable panic=abort and enable lto optimization
ordian added a commit to ordian/parity that referenced this pull request Jun 27, 2018
…rp_sync_on_light_client

* 'master' of https://github.com/paritytech/parity:
  Fix deadlock in blockchain. (openethereum#8977)
  snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 (openethereum#8984)
  Use local parity-dapps-glue instead of crate published at crates.io (openethereum#8983)
dvdplm added a commit that referenced this pull request Jun 27, 2018
* master:
  Refactor evm Instruction to be a c-like enum (#8914)
  Fix deadlock in blockchain. (#8977)
  snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 (#8984)
  Use local parity-dapps-glue instead of crate published at crates.io (#8983)
  parity: omit redundant last imported block number in light sync informant (#8962)
  Disable hardware-wallets on platforms that don't support `libusb` (#8464)
  Bump error-chain and quick_error versions (#8972)
dvdplm added a commit that referenced this pull request Jun 27, 2018
* master:
  Refactor evm Instruction to be a c-like enum (#8914)
  Fix deadlock in blockchain. (#8977)
  snap: downgrade rust to revision 1.26.2, ref snapcraft/+bug/1778530 (#8984)
  Use local parity-dapps-glue instead of crate published at crates.io (#8983)
  parity: omit redundant last imported block number in light sync informant (#8962)
  Disable hardware-wallets on platforms that don't support `libusb` (#8464)
  Bump error-chain and quick_error versions (#8972)
@arkpar
Copy link
Collaborator

arkpar commented Jul 19, 2018

Too late for the discussion, but panic="abort" does make code execution somewhat faster. Block import was faster by about 5% iirc. I'd recommend putting it back or doing some benchmarks at least.

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jul 19, 2018

@arkpar I think unwinding shouldn't impact runtime speed in any significant way, because it only affects the code generated when a panic actually happened (which won't do in normal execution). Can you be more specific on how you tested it's 5% faster?

@arkpar
Copy link
Collaborator

arkpar commented Jul 19, 2018

Import 1m blocks from a file.
I'm not sure if rust stack unwinding is completely free for non-throwing code. Usually stack unwinding requires some additional steps in function prologue to setup the frame information. Reduced binary size is also a factor as it increases cache hit rate.

@arkpar
Copy link
Collaborator

arkpar commented Jul 19, 2018

I'd benchmark compilation times as well

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jul 19, 2018

Just FYI, to revert to panic=abort we also need to revert this PR #8999.

I don't have really strong opinion on this, but it will mean that all Drop handlers will not be called again, so database cannot shutdown clean. This may be the cause of those db corruption issue reports we received, but I can't say I'm totally sure on that.

@arkpar
Copy link
Collaborator

arkpar commented Jul 19, 2018

Database has to be resistant to power loss anyway.

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jul 19, 2018

Reading this comment (rust-lang/rfcs#1765 (comment)), for runtime performance, the difference would only be the landing pads (but it can still result in reasonable performance gain).

@sorpaas
Copy link
Collaborator Author

sorpaas commented Jul 19, 2018

Reading this story (https://www.reddit.com/r/rust/comments/55ns2m/safe_and_efficient_bidirectional_trees/) it looks like landing pads are inserted together with unwrap and panic!. So with less of them we get less landing pads.

No matter whether we choose to use panic=abort or panic=unwind, it may be a good optimization to try to reduce the amount of panics we have in code, and try to move them to be checked by type system instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M5-dependencies 🖇 Dependencies. M8-dapp 💎 Decentralized applications. P2-asap 🌊 No need to stop dead in your tracks, however issue should be addressed as soon as possible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants