pocketnetteam / pocketnet.core

Decentralized social network based on the blockchain
https://pocketnet.app
Apache License 2.0
115 stars 28 forks source link

Getting Error -26 (500) out of the backend often #35

Closed mcqueenorama closed 3 years ago

mcqueenorama commented 3 years ago

Describe the bug UPDATE its working this morning

BLOCKED for hours now. Still can't post nor rate. Its not my browser or anything on my end. Its browser and phone and linux app.

I can't rate anything without getting an "error -26". The ratings don't succeed. I can't subscribe either when this happens, though the error is silent for the follow failures. The Dev Tools shows the same 500 still happening on the backend. One time I saw this when I was trying to post too and was not able to post.

Browser is Dissenter. I've seen it happening in the standalone Linux deb package too. Also happens via phone.

Must be the account? Maybe the backend servers, but then there'd be many seeing this problem, and I don't see anybody else complaining about it in the chat.

Attached image shows the sequence of network calls:

shot1

Here's the data from the Dev Tools for the first 500:

https://1.pocketnet.app:8899/rpc/sendrawtransactionwithmessage

POST /rpc/sendrawtransactionwithmessage HTTP/1.1
Host: 1.pocketnet.app:8899
Connection: keep-alive
Content-Length: 1103
Accept: application/json
Origin: https://pocketnet.app
Sec-Fetch-Dest: empty
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json;charset=utf-8
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
Referer: https://pocketnet.app/mrniceguy
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

HTTP/1.1 500 Internal Server Error
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization
X-Content-Type-Options: nosniff
Content-Type: application/json; charset=utf-8
Content-Length: 335
ETag: W/"14f-+mYItvsLaH9a6+1qLlGIFPYQ0OE"
Vary: Accept-Encoding
Date: Fri, 13 Aug 2021 23:54:16 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"error":{"error":{"code":-26,"message":"tx-timestamp-earlier-as-output (code 16)"},"code":-26,"node":{"host":"184.101.6.38","port":38081,"rpcuser":"","rpcpass":"","ws":8087,"name":"Pocketnet Node","addedby":"","key":"184.101.6.38:38081","testing":false,"stable":false,"canuse":true,"local":false,"peer":true,"wssusers":0}},"code":500}

To Reproduce

I don't know how to reproduce it. It seems to be from the backend.

Expected behavior Regular PN operations are expected to succeed.

Screenshots Screenshot is inline above

Desktop (please complete the following information):

mcqueen@mcqueen-pc:~$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.10 (Cosmic Cuttlefish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.10"
VERSION_ID="18.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=cosmic
UBUNTU_CODENAME=cosmic
mcqueen@mcqueen-pc:~$ 

Smartphone (please complete the following information): happens via phone too

Additional context Add any other context about the problem here.

mcqueenorama commented 3 years ago

Here's where the error is being generated:

https://github.com/pocketnetteam/pocketnet.core/blob/fe10a28cdf8d9d70397b7c68fda89eb57ba8caf4/src/validation.cpp#L1449

I'm suspicious of txPrev since its not initialized.

Looking at GetTransaction, maybe there are paths where GetTransaction would return without setting txOut which would produce a garbage value in txPrev

https://github.com/pocketnetteam/pocketnet.core/blob/fe10a28cdf8d9d70397b7c68fda89eb57ba8caf4/src/validation.cpp#L1030

mcqueenorama commented 3 years ago

Here's reproduction using curl. Its been happening for hours now. I've switch the pocketnet proxies, and the nodes.

mcqueen@mcqueen-pc:~$ curl -s 'https://pocketnet.app:8899/rpc/sendrawtransactionwithmessage' -H 'Connection: keep-alive' -H 'Accept: application/json' -H 'Origin: https://pocketnet.app' -H 'Sec-Fetch-Dest: empty' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' -H 'Content-Type: application/json;charset=utf-8' -H 'Sec-Fetch-Site: same-site' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://pocketnet.app/index' -H 'Accept-Language: en-US,en;q=0.9' --data-binary '{"parameters":["02000000cd4917610248d897eefa2bfb5a0122071931a5fed1fe8f87568e591326ab8d4c05dd3beba4030000006b48304502210096d46bfa498ea4a90c341fb151727b9c58b105eedeeff3d552731386117022560220569623f2e63a4c86f63b68ad842282fa3062d9b7eda4054d8e07c140abd38848012102060b5c4826464f0514042d8278b8f5c6bf51d681226b6207b0b8cfda67b6c37cffffffffb9f12a2014ad051826fc5ea5ca8cf653704bd34972d7da2ebbe28028dc40c0e6000000006b4830450221009834fd76a7f3cb38bef4bced85b64cb175a305f3aed9d6ba58a3a3e5f6ef63c0022053d71d26f620eff78fd46be4f805a5c126b364f2b07713c6403a0cc012e3971d012102060b5c4826464f0514042d8278b8f5c6bf51d681226b6207b0b8cfda67b6c37cffffffff020000000000000000536a0b7570766f74655368617265207ea07dd8290a90eb71b6c7547bf5951e9f05a505222d26d90cb9e002a202ee2124504e4d56356d5564734b3131705338347669575757424e575467663933393552703720359d1cf7250a0000001976a91432f6bdbffeab5f1773f770391dd25aa211da176488ac00000000",{"share":"8b3b8210ce3704b365161bf58bfefde98a790abc437dc05f89a53a1910cb40e4","value":"5"},"upvoteShare"],"method":"sendrawtransactionwithmessage","cachehash":"5d20ae3459c0096397da2e34d36b31b5","options":{"node":"51.174.99.18:38081"},"state":1}' --compressed  | jq . 
{
  "error": {
    "error": {
      "code": -26,
      "message": "tx-timestamp-earlier-as-output (code 16)"
    },
    "code": -26,
    "node": {
      "host": "51.174.99.18",
      "port": 38081,
      "rpcuser": "",
      "rpcpass": "",
      "ws": 8087,
      "name": "Pocketnet Node",
      "addedby": "",
      "key": "51.174.99.18:38081",
      "testing": false,
      "stable": false,
      "canuse": true,
      "local": false,
      "peer": true,
      "wssusers": 21
    }
  },
  "code": 500
}
mcqueen@mcqueen-pc:~$ 
mcqueenorama commented 3 years ago

It seems to be working this morning via phone and via web app. If this is due to a daily quota, then I don't know why it throws that particular error message. "message": "tx-timestamp-earlier-as-output (code 16)"

Anyway, I've seen it before and I'm sure I'll see it again.

andyoknen commented 3 years ago

is the correct time set on your computer? The transaction you created is really older than the input transaction it uses. The time of the node you are connecting to is correct.

It looks like this is a problem in the browser, try clearing the cache or using incognito mode for the test. Please let us know about the results

mcqueenorama commented 3 years ago

The time is correct on the laptop, but the problem happened when using my cell phone too. Its not a problem with the device. I'll try incognito mode next time I see this, though getting the same problem on my cell phone pretty strongly indicates its not the browser on my laptop.

pocketnetteam commented 3 years ago

That is, the problem is not permanent? How often do you observe this?

mcqueenorama commented 3 years ago

Correct, it is not permanent. I saw it for a few days, each day, and it lasted for hours. I will watch for it to return. I have not been online much the past two days. Here's a curious observation. I bought some pkoin and transferred them into my pocketnet account, and there was a correlation between the days I moved my pkoin into my pocketnet account, and the days when I observed this problems. No proof on that either.

RandomKori commented 3 years ago

I got this error too.

andyoknen commented 3 years ago

@RandomKori This problem is due to the fact that the new transaction has a timestamp older than the source of funds. This is usually due to setting the device time, the correct time zone, and resetting the cache. I