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

Deposit returns internal server error despite deposit being successful #2283

Closed
kelsos opened this Issue Aug 27, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@kelsos
Contributor

kelsos commented Aug 27, 2018

Problem Definition

I have a channel with a total_deposit of 51 and I change the total deposit to 61

{
   "token_network_identifier":"0x9FE1f19D8C0d2591Fd01486E575B44f4220eF241",
   "total_deposit":51,
   "channel_identifier":131,
   "balance":51,
   "state":"opened",
   "settle_timeout":500,
   "reveal_timeout":10,
   "token_address":"0x0f114A1E9Db192502E7856309cc899952b3db1ED",
   "partner_address":"0xF1538c3786Bf87bE4E4C2DB8C4eBA48f6bD00138"
}
{"total_deposit":61}

The request blocks as expected and after a while throws and returns a 500 internal server error. Despite the error, the deposit is successful. The next time the webui polls the channel endpoint I am getting the properly updated total_deposit.

  {
      "token_network_identifier":"0x9FE1f19D8C0d2591Fd01486E575B44f4220eF241",
      "total_deposit":61,
      "channel_identifier":131,
      "balance":61,
      "state":"opened",
      "settle_timeout":500,
      "reveal_timeout":10,
      "token_address":"0x0f114A1E9Db192502E7856309cc899952b3db1ED",
      "partner_address":"0xF1538c3786Bf87bE4E4C2DB8C4eBA48f6bD00138"
   }
2018-08-27 13:26:26 [info     ] 127.0.0.1 - - [2018-08-27 15:26:26] "PATCH /api/1/channels/0x0f114A1E9Db192502E7856309cc899952b3db1ED/0xF1538c3786Bf87bE4E4C2DB8C4eBA48f6bD00138 HTTP/1.1" 200 203 187.074328 [raiden.api.rest.pywsgi] 
2018-08-27 13:26:26 [error    ] Exception on /api/1/channels/0x0f114A1E9Db192502E7856309cc899952b3db1ED/0xF1538c3786Bf87bE4E4C2DB8C4eBA48f6bD00138 [PATCH] [flask.app] 
Traceback (most recent call last):
  File "/home/kelsos/.virtualenvs/raiden/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/kelsos/.virtualenvs/raiden/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/kelsos/.virtualenvs/raiden/lib/python3.6/site-packages/flask_restful/__init__.py", line 480, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/kelsos/.virtualenvs/raiden/lib/python3.6/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/kelsos/.virtualenvs/raiden/lib/python3.6/site-packages/flask_restful/__init__.py", line 595, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/kelsos/.virtualenvs/raiden/lib/python3.6/site-packages/webargs/core.py", line 441, in wrapper
    return func(*args, **kwargs)
  File "/home/kelsos/development/github/raiden-network/2/raiden/api/v1/resources.py", line 66, in patch
    **kwargs,
  File "/home/kelsos/development/github/raiden-network/2/raiden/api/rest.py", line 1132, in patch_channel
    result = self._deposit(registry_address, channel_state, total_deposit)
  File "/home/kelsos/development/github/raiden-network/2/raiden/api/rest.py", line 1006, in _deposit
    total_deposit,
  File "/home/kelsos/development/github/raiden-network/2/raiden/api/python.py", line 388, in set_total_channel_deposit
    channel_proxy.set_total_deposit(total_deposit)
  File "/home/kelsos/development/github/raiden-network/2/raiden/network/proxies/payment_channel.py", line 137, in set_total_deposit
    partner=self.participant2,
  File "/home/kelsos/development/github/raiden-network/2/raiden/network/proxies/token_network.py", line 540, in set_total_deposit
    raise ValueError(f'deposit {amount_to_deposit} must be greater than 0.')
ValueError: deposit 0 must be greater than 0.
2018-08-27 13:26:26 [info     ] 127.0.0.1 - - [2018-08-27 15:26:26] "PATCH /api/1/channels/0x0f114A1E9Db192502E7856309cc899952b3db1ED/0xF1538c3786Bf87bE4E4C2DB8C4eBA48f6bD00138 HTTP/1.1" 500 230 67.166890 [raiden.api.rest.pywsgi] 

System Description

Here add a detailed description of your system, e.g. output of the following script:

Linux forseti 4.18.4-arch1-1-ARCH #1 SMP PREEMPT Wed Aug 22 07:33:26 UTC 2018 x86_64 GNU/Linux
/usr/bin/geth
Geth
Version: 1.8.13-stable
Git Commit: 225171a4bfcc16bd12a1906b1e0d43d0b18c353b
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.3
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go
/home/kelsos/.virtualenvs/raiden/bin/raiden
{
  "raiden": "0.6.1.dev17+gdbabdfc1",
  "python_implementation": "CPython",
  "python_version": "3.6.6",
  "system": "Linux 64bit_ELF 4.18.4-arch1-1-ARCH x86_64",
  "distribution": "source"
}
dbabdfc1450cd11fab93b4f23f509bc1171b208e

@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Sep 3, 2018

@kelsos is this still an issue for you?

@LefterisJP LefterisJP self-assigned this Sep 3, 2018

@LefterisJP LefterisJP added this to the Red Eyes Testnet 8 milestone Sep 3, 2018

@kelsos

This comment has been minimized.

Contributor

kelsos commented Sep 3, 2018

@LefterisJP I just managed to replicate it so it still happens on master.

LefterisJP added a commit to LefterisJP/raiden that referenced this issue Sep 3, 2018

Fix set_total_deposit error handling
Fix raiden-network#2283

If two calls on the deposit happen one after another then a `ValueError` will be
thrown for the second one. We don't catch `ValueErrors` which will result in a
crash (500 Interval server error).

Turned them to `DepositMismatch` exception and also made the error string more informative
@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Sep 3, 2018

@kelsos Did you use the WebUI for it? I suspect that the WebUI has retries built into it.

@kelsos

This comment has been minimized.

Contributor

kelsos commented Sep 3, 2018

@LefterisJP yes It was through the webui I suspected something like this but I have to verify if that's the case.

rakanalh added a commit that referenced this issue Sep 3, 2018

Fix set_total_deposit error handling
Fix #2283

If two calls on the deposit happen one after another then a `ValueError` will be
thrown for the second one. We don't catch `ValueErrors` which will result in a
crash (500 Interval server error).

Turned them to `DepositMismatch` exception and also made the error string more informative
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment