Electron-cash: AttributeError: 'NoneType' object has no attribute 'endswith'

Created on 20 Jan 2020  路  9Comments  路  Source: Electron-Cash/Electron-Cash

Crash Report

This crash report was reported through the automatic crash reporting system 馃

Traceback

```Python traceback
File "site-packages\electron_cash-4.0.12-py3.6.egg\electroncash\util.py", line 766, in run_with_except_hook
File "site-packages\electron_cash-4.0.12-py3.6.egg\electroncash\network.py", line 1463, in run
File "site-packages\electron_cash-4.0.12-py3.6.egg\electroncash\network.py", line 1436, in wait_on_sockets
File "site-packages\electron_cash-4.0.12-py3.6.egg\electroncash\network.py", line 856, in process_responses

AttributeError: 'NoneType' object has no attribute 'endswith'
```

Reporter

This issue was reported by 2 user(s):

| Electron Cash Version | Python Version | Operating System | Wallet Type | Locale |
|---|---|---|---|---|
| 4.0.12 | 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)] | Windows-10-10.0.18362-SP0 | standard | en_US |
| 3.6.1 | 3.6.9 (default, Jun 28 2018, 19:01:02) [GCC 5.4.0 20160609] | Linux-4.15.0-74-generic-x86_64-with-debian-buster-sid | slp_standard | en_US |

Additional Information

computer ran out of memory, i don't think electon cash had anything it could do. i wasn't actively working in the wallet, it was just running in the background. if you need anything i'm at [email protected]


bug observation required

All 9 comments

This actually just occurred now, not 10 days ago. This was my report. Just messaging here in case there's any questions.

Two more reports of this from Android devices over the last 24 hours (#1794). Is something happening on the network, or on one of the servers?

Not that I know of but I'll look into it ...

This actually just occurred now, not 10 days ago. This was my report. Just messaging here in case there's any questions.

Hi, and thanks for writing. So what were you doing exactly when this happened? Do you happen to know which server Electron Cash was connected to? (That's unlikely for you to be able to discover unless you had manually set the server somehow yourself).

Was it the case the computer ran out of memory?

It looks like this happened to @kharri1073 today with Electron Cash 3.6.1 on Linux, which is a relatively old version. But it happened to someone else 10 days ago with Electron Cash 4.0.12 on Windows.

@cculianu Hi, the version is Electron Cash SLP 3.6.1. I believe i was connected to the electroncash.de server at the time.

I was browsing the web in chrome. I'm one of those people who leave things in tabs all day. Currently, chrome is using 13GB of memory which leaves little for ubuntu and other programs. My computer froze on this occasion for several minutes. When it finally awoke from its memory starved state, this error popped up.

My system freezes on occasion due to my browsing habits but this was the first time i ever saw this error in electron cash occur. As far as I can tell, nothing 'broke' in the wallet.

Hi -- thanks for the info. @mhsmith ; yeah sorry you're right this happens on multiple platforms, all in the same shared code. I still don't understand how the 'method' can end up as None, unless something in the codebase is pushing messages into the network with 'None' as the method.

I can't even see the server side (bad server) causing this problem, from my reading of the code. This definitely warrants more investigation and more digging. Very strange. I'm leaving this open as a relatively high priority fix.

Oh wait -- hmm. I know what's going on!!!

  1. User is connected to a Fulcrum server. This is a new server I wrote.
  2. Client timed out (in this case I bet it's due to swapping/thrashing not allowing Electron Cash to ever execute the 'ping' request).
  3. Fulcrum sends a JSON-RPC 'error' message to the client right before disconnecting the client. This is interpreted by Electron Cash as a 'notification' (else branch of this if here: https://github.com/Electron-Cash/Electron-Cash/blob/a7f86bbd7547b548e5d7952db4ccb0732e036d9c/lib/network.py#L864) but the method is missing from the message!

I'm not sure if this is a bug in Fulcrum or in Electron Cash, actually. There are situations when ElectrumX also sends these types of spurious messages (on e.g. malformed JSON). I'm opening an issue in my Fulcrum repo referencing this, and I will address this in Fulcrum, because even if Electron Cash is out-of-spec here, the reality is there are thousands of clients with the old code in place and it's easier to just make the server conform to the client's quirks, than vice-versa.

Regardless, it does however reveal fragility in the code here. I'm going to push a commit that addresses this. However I will also update Fulcrum to address this issue -- I'll make it so that it just will disconnect on idle silently (sans 'error' message to the client).

Issue I created in Fulcrum: https://github.com/cculianu/Fulcrum/issues/20

Update: I have released a new version of Fulcrum that works around this quirk in Electron Cash and notified all the server admins to update. Most of them have already updated. Hopefully after they all update we will never see this again in the crash reporter.

Was this page helpful?
0 / 5 - 0 ratings