Someguy123 / -Coin

+Coin is a web interface in PHP for Bitcoin based daemons released under the public domain (UNLICENSE)
The Unlicense
37 stars 51 forks source link

Error 500 while reading daemon's response #11

Open davidebaldini opened 8 years ago

davidebaldini commented 8 years ago

From jsonRPCClient.php, line 132:

                if ($fp = fopen($this->url, 'r', false, $context)) {                                                                           
                        $response = '';                                                                                                        
                        while($row = fgets($fp)) {                                                                                             
                                $response.= trim($row)."\n";                                                                                   
                        }                                                                                                                      
                        $this->debug && $this->debug.='***** Server response *****'."\n".$response.'***** End of server response *****'."\n";  
                        $response = json_decode($response,true);                                                                               
                } else {                                                                                                                       
                        throw new Exception('Unable to connect to '.$this->url);                                                               
                } 

the exception is thrown by simply invoking $ php5 index.php from the console. The output I get is;

$ php5  index.php
PHP Warning:  fopen(http://...@localhost:8332): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
 in /var/www/pluscoin/jsonRPCClient.php on line 132
<!DOCTYPE html>
<html lang='en'>
<head>
        <meta charset='utf-8'>
... /* etcetera */

The credentials are set and the daemon is running. Fore reference, with curl I get:

$ curl http://...@localhost:8332
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

The getbalance lines from index.php are modified as suggested here.

Someguy123 commented 8 years ago

I'll investigate this problem later when I have bitcoindset up to test. I'm not sure what has changed recently in Bitcoin to break this, as the JSONRPC should still be the same.

Someguy123 commented 8 years ago

Update: Today I discovered Bitcoin has reached 60GB. That makes it expensive to spin up a server. Do you know if this affects other coins (ones with a less ridiculous sized blockchain?) such as Litecoin, Dogecoin or Namecoin?

davidebaldini commented 8 years ago

After minimal debugging I found that this error 500 is simply due to header.php calling $nmc->walletlock() with an unencrypted wallet. AFAIK this is not supported by bitcoind and causes the error response. Apart from this, no actual disruption seems to occur at all.