Bitcoin Forum

Other => Beginners & Help => Topic started by: bpd3 on July 15, 2011, 07:15:36 PM



Title: [ Phoenix-miner : revision 111 -> RPCProtocol.bug = fixed ] :)
Post by: bpd3 on July 15, 2011, 07:15:36 PM
Hi,

Using svn version i got some error:
Code:
[15/07/2011 20:28:06] Result: 879b394b accepted         
[346.49 Mhash/sec] [6 Accepted] [0 Rejected] [RPC (+LP)]Traceback (most recent call last):
  File "/home/miner1/p2/minerutil/RPCProtocol.py", line 399, in longPo[15/07/2011 20:28:07] Long poll exception:             
[346.49 Mhash/sec] [6 Accepted] [0 Rejected] [RPC (+LP)]    (connection, result) = self.request(connection, url, self.headers)
  File "/home/miner1/p2/minerutil/RPCProtocol.py", line 250, in request
    result = loads(response.read())
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 360, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 378, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
I figured out that empty response message is passed to json parser. Although i never used python, i decided to fix it. C experience helps in almost every language :)
So in file RPCProtocol.py:
- line 233 change
Code:
        result = response = None
to:
Code:
        result = bpd3_fix =response = None

- line 250 change
Code:
            #Check for server messages                                                                                        
            result = loads(response.read())                                                                                   
to:
Code:
            #Check for server messages                                                                                        
            bpd3_fix = response.read()
   
            if len(bpd3_fix) > 0:
                     result = loads(bpd3_fix)                                                                                         

- line 263 change
Code:
            return (connection, result)                                                                                       
        finally:
to:
Code:
            return (connection, result)                                                                                       

        except:                                                                                                           
             self.log('Empyt answer...?')                                                                                 
        finally:

- line 410 (end of file) add
Code:
                 except:                                                                                                       
                       self.log('Long poll: keep-alive..!')

With that patch u should see smtg like this:
Code:
[15/07/2011 20:59:48] Result: 09cfdec6 accepted         
[15/07/2011 20:59:59] Empyt answer...?                 
[15/07/2011 20:59:59] Long poll: keep-alive..! 
[15/07/2011 21:00:06] Result: 17221706 accepted         
[346.60 Mhash/sec] [6 Accepted] [0 Rejected] [RPC (+LP)]

Since there is exception handling in separate thread this bug was rather annoying than critical (no crash). Please remember it's my first python experience ever but if you found this patch useful you can always send some bits to: 1F3cdXnq9ja7bB8DRkavZsG9WQH7USfZyz
Hope author of Phoenix-miner software or any miner interested in using revision 111 of Phoniex will find this post in the newbie section :)

Greetings


Title: Re: [ Phoenix-miner : revision 111 -> RPCProtocol.bug = fixed ] :)
Post by: Newestminer on July 27, 2011, 05:02:46 AM
I am getting the same error as you were.  Tried your fix and restarted my miners.  I was hoping that you had better luck since this did not work for me ???