YoRyan / nuxhash

A NiceHash cryptocurrency mining client for Linux.
GNU General Public License v3.0
264 stars 164 forks source link

hanging after "WARNING:root:This interval will be donation time." #18

Closed oneEyedCharlie closed 6 years ago

oneEyedCharlie commented 6 years ago

After running a while, I get the message:

WARNING:root:This interval will be donation time.
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 337, in run
    self._scheduler.run()
  File "/usr/lib/python3.6/sched.py", line 154, in run
    action(*argument, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 387, in _switch_algos
    miner.settings = donate_settings
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/miners/excavator.py", line 352, in settings
    self.server.settings = v
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/miners/excavator.py", line 83, in settings
    self._subscribe()
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/miners/excavator.py", line 119, in _subscribe
    self._auth])
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/miners/excavator.py", line 152, in send_command
    with socket.create_connection(self._address, self.TIMEOUT) as s:
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

At that point, I have to search out the process and kill it. Using the "Stop Mining" button doesn't actually stop it then. Nor does closing the gui. After manually killing the process, I can start everything up normally again

Thank you

YoRyan commented 6 years ago

Thanks for the report! Fix is in master now; hopefully this is the last of the donation period bugs.

Also, we use process groups properly now, so there should be no weird states wherein nuxhash dies but the miners don't or vice-versa.

oneEyedCharlie commented 6 years ago

Thank you for nuxhash! Will give it a try and report back if anything goes wrong.

oneEyedCharlie commented 6 years ago

Left it running last night, and unfortunately, it's still there. Although the errors have changed some.

WARNING:root:This interval will be donation time.
Exception in thread Thread-49:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 138, in request
    balance = unpaid_balance(address)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/nicehash.py", line 39, in unpaid_balance
    result = api_call('stats.provider', { 'addr': address })
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/nicehash.py", line 26, in api_call
    % urlencode(get_data), timeout=TIMEOUT) as request:
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
YoRyan commented 6 years ago

Did the GUI still work? That code runs in a separate thread, so there shouldn't be an issue if it generates an exception. Although it would be nice to catch it so it doesn't look so scary.

oneEyedCharlie commented 6 years ago

The GUI has always looked like it is still working. There are several things I should mention. First, I've been running it from a command line in Mint 19 Cinnamon. I haven't yet shown you the warnings that the GUI generates on my system, since it seems to have been working despite the warnings, but I'll include that this time just in case it matters. Here's the entire terminal output for the current run, which failed after a few hours when the "WARNING:root:This interval will be donation time" pops up. The failure always happens at the "WARNING:root:This interval will be donation time". It hasn't generated any more errors after that statement, but all the video cards remain silent after that. After some more time went by, an additional "WARNING:root:This interval will be donation time" popped up after the first.

user@user-Mint19:~$ nuxhash-gui

(nuxhash-gui:14891): Gtk-CRITICAL **: 14:45:45.701: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.701: Negative content width -33 (allocation 1, extents 17x17) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.701: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.701: Negative content width -33 (allocation 1, extents 17x17) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.701: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.701: Negative content width -33 (allocation 1, extents 17x17) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.701: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.706: Negative content width -9 (allocation 1, extents 5x5) while allocating gadget (node entry, owner GtkEntry)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.711: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(nuxhash-gui:14891): Gtk-WARNING **: 14:45:45.711: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)
WARNING:root:This interval will be donation time.
WARNING:root:This interval will be donation time.

I should also mention that when I ran it for 24 hours a few days ago and had disabled the donation in the config file, it ran that entire period without issue.

YoRyan commented 6 years ago

The GTK warnings are harmless. Are you saying the GUI ceases to respond normally after the first donation interval? That shouldn't happen if there are no more exceptions being generated.

oneEyedCharlie commented 6 years ago

Not quite. I'm saying that my 3 cards totally quit mining at the moment the donation warning message appears. Their temps drop from their normal of about 70C to their idle base of about 35C, and the chart at Nicehash shows the drop to zero on all 3 cards. https://i.imgur.com/rQ9C50l.png The GUI acts as though nothing is wrong, except that it then shows the Daily revenues and speeds drop to zero. https://i.imgur.com/uFj8cI4.png If I then hit the "stop mining" button, nothing happens, other than the GUI acts normally. If I then hit "start mining" again, it will actually start mining again. I wonder what would happen if I just left it for a few hours after it stops...

-----edit---- Running more tests. It's not failing quite the way I thought it was. Will post those results tonight or tomorrow (Saturday).

oneEyedCharlie commented 6 years ago

I did another run of about 6 hours. It failed a few hours into it again, and again this time it happened at the first "WARNING:root:This interval will be donation time." Here is a temperature graph of my 3 cards for the last 4 hours. https://i.imgur.com/QxV4v8U.png You can see the failure about an hour into it. No other errors occurred except another donation time warning. I do not know at what time that second warning popped up. What's curious, is that it about 20 minutes later, one of the cards came back to life for a few minutes, then died again. About an hour after that, 2 cards simultaneously did the same thing. This kind of thing happened several more times over the remaining hours, eventually happening to all 3 cards. I could see that small amount of revenue was generated at Nicehash during those spikes, so it was real. One of the spikes on one of the cards lasted several minutes longer than all the others.

I then did another run, but I put optout = True in the config file. That one seems to have ran great for 5 straight hours: https://i.imgur.com/65YJRg9.png HOWEVER, more weirdness, it has generated some errors, but powers on through them seemingly with no problem:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 349, in _switch_algos
    payrates, stratums = nicehash.simplemultialgo_info(self._settings)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/nicehash.py", line 45, in simplemultialgo_info
    response = api_call('simplemultialgo.info', [])
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/nicehash.py", line 26, in api_call
    % urlencode(get_data), timeout=TIMEOUT) as request:
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1361, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1321, in do_open
    r = h.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 337, in run
    self._scheduler.run()
  File "/usr/lib/python3.6/sched.py", line 154, in run
    action(*argument, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 350, in _switch_algos
    except (socket.error, socket.timeout, SSLError, URLError) as err:
NameError: name 'socket' is not defined

And now that I look at the GUI itself, it seems frozen. The revenue number is not fluctuating at all. I assume it is just stuck mining at the last selected algos? I also wonder if this is all related, and maybe the donation warning has nothing to do with it?

So now I'm hitting the "stop mining" button. The GUI acts as though everything has stopped successfully. But I can see that the cards are still hot (mining), and I see that excavator processes are still running in htop. So now I'm going to close the GUI... The GUI itself has closed, but the terminal window I was running it out of was not released like it normally does. And excavator is still mining. OK so I'm going to CTRL-C the term window... OK that did it. Mining halted.

I don't understand what's going on. But I hope this helps you to figure it out. Thank you for creating this software.

oneEyedCharlie commented 6 years ago

So maybe ignore this bug for now. I've discovered a problem with my system that may be causing this bug. Let me run tests for a day or two and I'll post back here if it fixes it.

oneEyedCharlie commented 6 years ago

OK was wrong. After running more tests I've got nothing.

YoRyan commented 6 years ago

Okay, I found more unhandled crashes - they happened when there's a connection problem connecting to the NiceHash API. My testing shows the donation period switching should work now so I think this is a coincidence after several hours of running.

oneEyedCharlie commented 6 years ago

OK will give it a shot and report back in about a day or two.

oneEyedCharlie commented 6 years ago

Slightly different error this time:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 352, in _switch_algos
    payrates, stratums = nicehash.simplemultialgo_info(self._settings)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/nicehash.py", line 45, in simplemultialgo_info
    response = api_call('simplemultialgo.info', [])
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/nicehash.py", line 26, in api_call
    % urlencode(get_data), timeout=TIMEOUT) as request:
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 340, in run
    self._scheduler.run()
  File "/usr/lib/python3.6/sched.py", line 154, in run
    action(*argument, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/nuxhash/gui/mining.py", line 353, in _switch_algos
    except (os.ConnectionError, socket.error,
AttributeError: module 'os' has no attribute 'ConnectionError'

Maybe 503 is unhandled too?

YoRyan commented 6 years ago

Nope, just a typo and some more missing exception classes. This should do it...

oneEyedCharlie commented 6 years ago

Giving it another go, will take a day or 2.

oneEyedCharlie commented 6 years ago

Pleased to report that everything is working great now! Thanks again.

YoRyan commented 6 years ago

Glad to hear it!