Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethereum bridge stops writing into tingodb after sometime #51

Open
mandritac opened this issue May 7, 2018 · 21 comments
Open

Ethereum bridge stops writing into tingodb after sometime #51

mandritac opened this issue May 7, 2018 · 21 comments
Labels

Comments

@mandritac
Copy link

Hi,

I have setup ethereum-bridge on a private network running on Node js 6.14.1 on Ubuntu machine 16.04.3 LTS. One peculiar thing I see is that after sometime the Queries and callback files residing under tingodb stops getting updated. As a result all my Oraclize queries fail at ethereum-bridge node. If I clear the tingodb and re-install ethereum-bridge then the thing starts working but I can see for one HTTP request multiple callbacks coming, however I can still get the query response. But after a few Oraclize queries again the issue starts occurring. Why is this issue occurring and can this be avoided?

Thanks.

@D-Nice
Copy link
Contributor

D-Nice commented May 9, 2018

Hi @mandritac

Can you share which flags you're running the ethereum-bridge with? Please add the --dev flag if testing it with ganache/testrpc.

@mandritac
Copy link
Author

Hi,

node bridge -H ip:rpc_port --broadcast --instance oracle_instance_20180507T175817.json

Using the above command and no I am neither using ganache/testrpc. I am directly connecting the ethereum-bridge to our private blockchain network. For testing I have used truffle.

Thanks.

@D-Nice D-Nice added the bug label May 10, 2018
@D-Nice
Copy link
Contributor

D-Nice commented May 10, 2018

Could you try the 2018_3_updates branch, and verify if same issue occurs there? Most of our production env uses that branch, and we haven't seen the issue you mention in a while with that branch. Would be useful to confirm if it's indeed fixed there, or if we need to investigate it more.

@mandritac
Copy link
Author

Hi,
Ok I'll test and update you on this.

Thanks,

@mandritac
Copy link
Author

Hi,

No when I tried installing "2018_3_updates" it didn't work even once i.e; the Queries and callback files are not getting updated with any contents. I tried deleting the files, restarting the bridge but it didn't help.

Thanks.

@D-Nice
Copy link
Contributor

D-Nice commented May 16, 2018

can you try deleting node_modules folder, and install the dependencies using yarn instead, it should give you a more deterministic dep tree.

@mandritac
Copy link
Author

Hi,

No it is not working even after using yarn to install the dependencies. Strangely it did work when I had freshly installed ethereum bridge using npm only, but now it is not working at all. Can any other log be enabled to check why it is not writing anything in Queries and callback files under tingodb?

I have attached some additional files/logs
AttachedFiles.zip
from my system for your reference.
Thanks.

@mandritac
Copy link
Author

Also I am uploading the contract file used for testing the setup and I am using truffle to test with the following commands -

var poe = TestOraclizeCall.at(TestOraclizeCall.address)
poe.update(400000,{gas:4712388,from: web3.eth.accounts[0]}) // for first oraclize call
poe.update(400000,{gas:4712388,from: web3.eth.accounts[0],value:web3.toWei(0.10, "ether")})//for any subsequent calls

Thanks.
TestOraclizeCall.zip

@D-Nice
Copy link
Contributor

D-Nice commented May 17, 2018

Thanks, we'll take a look

@D-Nice
Copy link
Contributor

D-Nice commented May 17, 2018

I've just tested your code, and it works fine on my end, using the ethereum-bridge on npm. Added a res storage variable to save the result:

truffle(development)> TestOraclizeCall.deployed().then(x => x.res.call())
'7063.51'

I followed the calls you used. The first call will fail to create a query, because using a gas limit greater than the default 200k, will not be free, and no value was sent. I haven't been able to pinpoint anything too unusual in your logs, except make sure that your node is sync'd and not syncing. It could be node issues. Best way to eliminate that as an issue is to try with ganache/testrpc.

Here was the setup I used:
Truffle v4.1.3 (I recommend using this version, later versions appear to have incompatibilities, probably due to solc issues)
Ganache CLI v7.0.0-beta.0 (ganache-core: 3.0.0-beta.0)
ethereum-bridge - version: 0.6.0-beta

The most important one to match is probably truffle, the other one's are quite stable comparatively.

@mandritac
Copy link
Author

Hi,
I can't use testrpc for this purpose. You mentioned about some node sync issue, how can that be checked?
I was also wondering how come it was working properly and suddenly stopped working? Definitely then this can be node sync issue. Can you please share more details on how to debug the node sync issue?

Thanks.

@D-Nice
Copy link
Contributor

D-Nice commented May 17, 2018

First, ensure your node is fully sync'd to your network, should be possible with the following web3 call: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethissyncing or direct RPC call.

I understand if you can't use testrpc for this purpose, but can you at least do a test-run with it, that way we can eliminate it down to the node being the issue, as I can confirm all the parts should work, and your code as is, is fine.

@mandritac
Copy link
Author

Hi,
It worked partially with testrpc, partially in the sense callback of the result failed. I used - EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2),not the testrpc you recommended since I had that version already installed. One more point though the private network I have setup doesn't have any peers connected to it. It is running standalone.

Thanks.

@mandritac
Copy link
Author

Hi,
After testing with rpc it again started with my private network also, so I guess this is not a node issue at all. The files in tingodb are getting updated again.

Thanks.

@mandritac
Copy link
Author

Hi,

Currently on ethereum-bridge the query is posted and it is also sending the callback but the function _callback(..) is never called, so the contract is not receiving the callback result from Oraclize.

Thanks.

@D-Nice
Copy link
Contributor

D-Nice commented May 18, 2018

@mandritac Thanks for updating, but I'm unable to reproduce your issues. I have tried your code, and the callback did indeed work fine. How do you know the __callback is never called? I recommend adding a storage variable that gets written when it's called, and that way you can check if it indeed was or wasn't, as I had above.

@mandritac
Copy link
Author

Hi,

I can confirm that callback is not fired in the smart contract because from that method I have an event generated and that event is not emitted. However I must state here that it was working earlier prior to all these issues. But now even though ethereum-bridge is sending back the callback, the event is not getting generated from the _callback function. Will try using state variables as suggested by you.

Thanks.

@mandritac
Copy link
Author

Hi,

This is my observation after several rounds of testing and making some modifications in contract code.

  • The Oraclize callback function call was failing because I was not mentioning enough gas limit in the query call. Hence though ethereum bridge was returning the callback and the transaction was mining in the ethereum node, still the transaction was getting rejected due to inadequate gas limit mentioned.

  • Though I have given a very high limit value I am not sure how to set optimal value for the callback function since every time the query response will return a different value. So is there any way to estimate gas limit of functions with dynamic data?.

  • Also at contract level I have made some changes like added custom gas price for the query and have set both TLS and IPFS to reduce gas cost on callback.

  • Also when the callback transactions got rejected then only this tingodb somehow stops getting updated. Currently I am not facing the issue that the files are not getting updated.

Thanks.

@D-Nice
Copy link
Contributor

D-Nice commented May 22, 2018

Thanks for the update on this.
Yes, I see in your code you were in fact just requesting a raw TLSNotary, which can be very large depending on the endpoint you're hitting, hence why we provide the IPFS storage option, to store it on there and instead just get a consistent size IPFS multihash.

@edhyfito
Copy link

Hi admin

@xuesu
Copy link

xuesu commented Jul 6, 2019

hi, my bridge was running well but suddenly it showed the following msgs and exited

[2019-07-06T05:06:38.885Z] INFO Listening @ 0x20348ad874c25ad33f7a5895a5603e01e5dd8396 (Oraclize Connector)

(Ctrl+C to exit)

[2019-07-06T05:06:39.651Z] INFO fetching pending queries from database with oar: 0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475 and callback address: 0x030b5402340fd5282ddbec37c75bf910071fe0f7
[2019-07-06T05:06:39.682Z] INFO found a total of 0 pending queries
Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545.
    at Object.InvalidConnection (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\errors.js:31:16)
    at HttpProvider.send (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\httpprovider.js:94:18)
    at RequestManager.send (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\requestmanager.js:58:32)
    at Object.send [as uninstallFilter] (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\method.js:145:58)
    at Filter.stopWatching (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\filter.js:209:36)
    at C:\Users\Iris\go\bin\ethereum-bridge\lib\bridge-log-manager.js:59:67
    at Object.callback (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\filter.js:225:21)
    at C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\method.js:142:25
    at C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\requestmanager.js:89:9
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\web3\lib\web3\httpprovider.js:129:7)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (C:\Users\Iris\go\bin\ethereum-bridge\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1125:12)

Please wait...
fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'C:\Users\Iris\go\bin\ethereum-bridge\config\instance\latest'
    at Object.openSync (fs.js:438:3)
    at Object.readFileSync (fs.js:343:35)
    at process.<anonymous> (C:\Users\Iris\go\bin\ethereum-bridge\bridge.js:1274:44)
    at process.emit (events.js:189:13)
    at process.exit (internal/process/per_thread.js:168:15)
    at process.removeAllLogs (C:\Users\Iris\go\bin\ethereum-bridge\lib\bridge-log-manager.js:154:18)
    at process.emit (events.js:189:13)
    at process._fatalException (internal/bootstrap/node.js:496:27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants