Comments (18)
Reopening because this issue may exist if other API's provide callbacks, we'll need to review each one. Also there should be a way in the framework, so creating an API which provides a callback involves a minimum amount of boilerplate.
from steem.
Can we get confirmation that those other issues #10 #11, and #26 occurred after broadcasting a transaction and then disconnecting before confirmation?
The OP was close to understanding the root cause. The network_broadcast_api is always created via make_shared() so shared_from_this() should always be valid. The problem is the constructor of registered a callback with the chain database that contained a raw pointer. When a new block was applied, this raw pointer was dereferenced to call on_applied_block(). shared_from_this() returned null at this point because the raw pointer was invalid.
The fix is to pass a weak pointer into the callback, but this means the callback cannot be registered in the constructor because shared_from_this() is not valid in the constructor.
from steem.
I think it may be a race, the signal handler should be deregistered when the _applied_block_connection
object is deleted in the API object's destructor. So usually you'd avoid calling with invalid this
, because the thing which causes the calls (existing as a signal handler) stops happening around the time this
becomes invalid (which happens because this
was destroyed, which would have caused the signal handler to be deregistered when the connection member object was destroyed).
But if the signal handler execution's already started, it can't be cancelled in flight, leading to problems if it expects this
to be valid for the duration of the call. So @bytemaster's patch looks like the correct solution -- using a weak_ptr
which you lock()
and then test the result instead of using this
as a raw pointer.
from steem.
it still crashes... However, it looks like some progress has been made. When entering on_applied_block, capture_this is now valid, but it crashes a bit later while instantiating the async task and copying (?) the lambda. I have to admit that at this point, what is actually happening eludes me, so here are some screenshots of the debugger (sorry for the small size, I'm travelling and only have my laptop)
frame 5, up till here all good
frame 4, 3, 2: creating the async task
frame 1: for some reason here inside the lambda, capture_this
is null again... btw, if we have capture_this
, is it necessary to also capture this
in the declaration of the lambda?
let me know if I can do anything else to help
from steem.
I think it might have something to do with the iterator containing the lambda being erased. I opted for a slow memory leak rather than a crash. See if the latest commits fix it. If so then we can dig deeper.
from steem.
In refactoring the original patch I found that database_api
suffers from the same bug. Just pushed 9936892 to develop which should fix database_api
at least.
from steem.
still crashes in the same place...
from steem.
Can we get confirmation that those other issues #10 #11, and #26 occurred after broadcasting a transaction and then disconnecting before confirmation?
None of those issues are related to broadcasting a transaction --- the node on which those occur only serves as an RPC API, and the only calls I make are reading the state.
from steem.
I was wondering whether it was a problem with the OS or the compiler/libc++, so I tried compiling on linux using clang as compiler to see whether it would crash (debian jessie, clang-3.5, boost 1.58.0). It turns out that it works perfectly there. So it would seem that the issue is either OSX-specific or comes from a difference between clang/libc++ 3.5.0 on linux and clang/libc++ (Apple LLVM version 7.3.0) on OSX.
from steem.
Bumping since this is still an issue for me, and a quite annoying one since it makes it impossible to use either the cli_wallet or a local websocket connection when developing for steemit.com. As soon as I make a transaction of any kind, steemd segfaults and I then need to do a full replay.
Boost version: 1.60.0
OPENSSL_VERSION = 1.0.2h
from steem.
I put a bounty of 400 STEEM on this bug, if anyone is interested... (I can also pay 800 SD, which is what 400 STEEM was worth at the time the bounty was set). See https://steemit.com/steem/@wackou/btstools-development-bounties
from steem.
This is likely duplicate of #281. I've identified the root cause and a patch will be pushed soon.
from steem.
@theoreticalbts could you please verify that #281 fixes this and close if so?
from steem.
v0.14.2 still exhibits this issue...
from steem.
I just compiled and synced from the develop branch and it also still exhibits this issue. Definitely not fixed.
from steem.
@sneak I cannot verify that this is fixed because I cannot reproduce it. It only seems to happen on some machines, and it has never happened on any machine I have used.
from steem.
The network_broadcast API will be deprecated and replaced by a stateless network_broadcast2 API, as discussed in #490. Closing this ticket as wontfix.
from steem.
For backward compatibility and to facilitate smooth transition to new stateless API we still need to fix this.
from steem.
Related Issues (20)
- Can't write post on Steemit HOT 4
- How To Setup Full Steem Blockchain Node with public API
- STEEM status? HOT 2
- --replay-blockchain so much slowly...
- moha20
- You know stealing is wrong HOT 7
- 170,000 Steem was removed from my account. HOT 5
- v0.23.0 Incomplete release notes
- errors when building steemit on Mac HOT 1
- Memory needed to build and run steem HOT 1
- I know why everyone turned interest rate to zero :p
- how to replay block_log after running steem in docker HOT 2
- Request to remove account from search engines HOT 6
- Block Reward
- Compile error on Ubuntu 18.04
- block_log-latest is no longer download-able HOT 3
- Vulnerability Report- 2FA Code Bypass HOT 10
- https://steemit.com//example.com/?r=
- Chainbase revision does not match head block num #345
- Sign up phone validation failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from steem.