Skip to content
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

[Fatal] [Program] [global] Terminating because of unhandled exception! CoiniumServ.Daemon.Exceptions.GenericRpcException #569

Closed
frndxyz opened this issue Oct 14, 2014 · 8 comments
Labels
Milestone

Comments

@frndxyz
Copy link

frndxyz commented Oct 14, 2014

[Fatal] [Program] [global] Terminating because of unhandled exception!
CoiniumServ.Daemon.Exceptions.GenericRpcException: The operation has timed out ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at CoiniumServ.Daemon.DaemonBase.GetJsonResponse(HttpWebRequest httpWebRequest) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Daemon\DaemonBase.cs:line 187
--- End of inner exception stack trace ---
at CoiniumServ.Daemon.DaemonBase.GetJsonResponse(HttpWebRequest httpWebRequest) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Daemon\DaemonBase.cs:line 210
at CoiniumServ.Daemon.DaemonBase.GetRpcResponse[T](HttpWebRequest httpWebRequest) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Daemon\DaemonBase.cs:line 164
at CoiniumServ.Daemon.DaemonBase.MakeRpcRequest[T](DaemonRequest walletRequest) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Daemon\DaemonBase.cs:line 92
at CoiniumServ.Daemon.DaemonBase.MakeRequest[T](String method, Object[] parameters) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Daemon\DaemonBase.cs:line 78
at CoiniumServ.Daemon.DaemonClient.ValidateAddress(String walletAddress) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Daemon\DaemonClient.cs:line 763
at CoiniumServ.Payments.PaymentProcessor.GetTransactionCandidates() in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Payments\PaymentProcessor.cs:line 110
at CoiniumServ.Payments.PaymentProcessor.Run() in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Payments\PaymentProcessor.cs:line 78
at CoiniumServ.Payments.PaymentManager.Run(Object state) in c:\Users\Administrator\Desktop\CoiniumServ-develop-git\src\CoiniumServ\Payments\PaymentManager.cs:line 69
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

@frndxyz
Copy link
Author

frndxyz commented Oct 19, 2014

set deamon timeout to 10 seconds can decrese the chance of exception. but why this exception is unhandled in code.

@bonesoul
Copy link
Owner

it's actually handled in the code - but don't know how this was caused.

@frndxyz
Copy link
Author

frndxyz commented Oct 20, 2014

all exception are throwen in this code. so where actually is handle i cant able to find please help me so i can solve this problem.

private string GetJsonResponse(HttpWebRequest httpWebRequest)
{
try
{
WebResponse webResponse = httpWebRequest.GetResponse();

            // Deserialize the json response
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                string result = reader.ReadToEnd();
                reader.Close();

                return result;
            }
        }
        catch (ProtocolViolationException protocolException)
        {
            throw _rpcExceptionFactory.GetRpcException(protocolException);
        }
        catch (WebException webException)
        {
            var response = webException.Response as HttpWebResponse;

            if (response == null)
                throw _rpcExceptionFactory.GetRpcException("Error while reading json response", webException);

            using (var stream = response.GetResponseStream())
            {
                using (var reader = new StreamReader(stream))
                {
                    string error = reader.ReadToEnd(); // read the error response.

                    // we actually expect a json error response here, but it seems some coins may return non-json responses.
                    try
                    {
                        var errorResponse = JsonConvert.DeserializeObject<RpcErrorResponse>(error); // so let's try parsing the error response as json.
                        throw _rpcExceptionFactory.GetRpcErrorException(errorResponse); // if we can use the error json
                    }
                    catch (JsonException e) // if we can't parse the error response as json
                    {
                        throw _rpcExceptionFactory.GetRpcException(error, e); // then just use the error text.
                    }
                }
            }
        }
        catch (Exception exception)
        {
            throw _rpcExceptionFactory.GetRpcException("An unknown exception occured while trying to read the JSON response.", exception);
        }
    }

@bonesoul
Copy link
Owner

» 17:10:45.136  CoiniumServ.Daemon.Exceptions.GenericRpcException: The request timed out ---> System.Net.WebException: The request timed out
» 17:10:45.136    at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Daemon.DaemonBase.MakeHttpRequest (CoiniumServ.Daemon.DaemonRequest walletRequest) [0x00000] in <filename unknown>:0
» 17:10:45.136    --- End of inner exception stack trace ---
» 17:10:45.136    at CoiniumServ.Daemon.DaemonBase.MakeHttpRequest (CoiniumServ.Daemon.DaemonRequest walletRequest) [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Daemon.DaemonBase.MakeRpcRequest[ValidateAddress] (CoiniumServ.Daemon.DaemonRequest walletRequest) [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Daemon.DaemonBase.MakeRequest[ValidateAddress] (System.String method, System.Object[] parameters) [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Daemon.DaemonClient.ValidateAddress (System.String walletAddress) [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Payments.PaymentProcessor.GetTransactionCandidates () [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Payments.PaymentProcessor.Run () [0x00000] in <filename unknown>:0
» 17:10:45.136    at CoiniumServ.Payments.PaymentManager.Run (System.Object state) [0x00000] in <filename unknown>:0
» 17:10:45.136    at System.Threading.Timer+Scheduler.TimerCB (System.Object o) [0x00000] in <filename unknown>:0

@bonesoul
Copy link
Owner

hopefully fixed in 8af76dd

@bonesoul
Copy link
Owner

@frndxyz do you still get the error with 0.2.4 - i guess it's fixed now along with some other crashes.

@frndxyz
Copy link
Author

frndxyz commented Oct 28, 2014

i was occour rarely. but not faced yet after yesterdays update. may be it solved. i will get you know if i faced it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants