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

Fixed panic handling #1667

Merged
merged 1 commit into from
Feb 4, 2019
Merged

Fixed panic handling #1667

merged 1 commit into from
Feb 4, 2019

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Feb 3, 2019

Closes #1470

@arkpar arkpar added A0-please_review Pull request needs code review. B0-patchthis labels Feb 3, 2019
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

Looks good, but requires an pr to the node-template.

")}

/// Set aborting flag. Returns previous value of the flag.
pub fn set_abort(enabled: bool) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

I think this function should not be public?

Copy link
Contributor

Choose a reason for hiding this comment

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

panics in the runtime should not abort, but panics in client code, including exernalities, should.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bkchr I'd leave it public in case someone needs to set and forget. The crate API aims to be universal.

@@ -181,35 +181,41 @@ where
H::Out: Ord + HeapSizeOf,
{
fn storage(&self, key: &[u8]) -> Option<Vec<u8>> {
let _guard = panic_handler::AbortGuard::new(true);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to abort here?

Copy link
Member Author

Choose a reason for hiding this comment

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

As @rphmeier answered in the wrong comment, client code panic should not lead to runtime error and potential consensus issues. Also panic behaviour between native and wasm runtimes needs to be consistent.

Copy link
Member

Choose a reason for hiding this comment

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

Okay. :)

@bkchr bkchr added A8-looksgood and removed A0-please_review Pull request needs code review. labels Feb 4, 2019
@bkchr bkchr merged commit 6741381 into master Feb 4, 2019
@bkchr bkchr deleted the a-fix-call-panic branch February 4, 2019 08:11
cmichi added a commit that referenced this pull request Feb 4, 2019
This reverts commit 32dfa1d.

In the meantime this was fixed in #1667.
gavofyork pushed a commit that referenced this pull request Feb 4, 2019
* Link substrate issue tracker in panic

* Replace allocator with freeing-bump allocator

* Revert me: Panic on double allocate/free

* Revert me: Add shallow benchmark for a first impression

* Revert "Revert me: Add shallow benchmark for a first impression"

This reverts commit 5f0d4df.

* Revert "Revert me: Panic on double allocate/free"

This reverts commit a114df7.

* Rename heap to FreeingBumpHeapAllocator

* Rename heap.rs to allocator.rs

* Use sandbox heap

* Move functions

* Move variables into constructor

* Revert "Move variables into constructor"

This reverts commit f46fa0d.

* Remove unnecessary casts

* Add comment for new parameter

* Improve typing

* Move variables into constructor

* Avoid dynamic allocation

* Remove unused variables

* Revert "Link substrate issue tracker in panic"

This reverts commit 32dfa1d.

In the meantime this was fixed in #1667.

* Improve naming

* Only assert in debug mode

* Remove dynamic allocation
MTDK1 pushed a commit to bdevux/substrate that referenced this pull request Apr 12, 2019
MTDK1 pushed a commit to bdevux/substrate that referenced this pull request Apr 12, 2019
* Link substrate issue tracker in panic

* Replace allocator with freeing-bump allocator

* Revert me: Panic on double allocate/free

* Revert me: Add shallow benchmark for a first impression

* Revert "Revert me: Add shallow benchmark for a first impression"

This reverts commit 5f0d4df.

* Revert "Revert me: Panic on double allocate/free"

This reverts commit a114df7.

* Rename heap to FreeingBumpHeapAllocator

* Rename heap.rs to allocator.rs

* Use sandbox heap

* Move functions

* Move variables into constructor

* Revert "Move variables into constructor"

This reverts commit f46fa0d.

* Remove unnecessary casts

* Add comment for new parameter

* Improve typing

* Move variables into constructor

* Avoid dynamic allocation

* Remove unused variables

* Revert "Link substrate issue tracker in panic"

This reverts commit 32dfa1d.

In the meantime this was fixed in paritytech#1667.

* Improve naming

* Only assert in debug mode

* Remove dynamic allocation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic should abort
4 participants