Permalink
Browse files

fix #174: increase named pipe connection attempt default

  • Loading branch information...
1 parent 6bdc124 commit 3efa757f128ccb6322f6484c3a76290eac9ad6f1 @tjanczuk tjanczuk committed Jun 26, 2012
@@ -33,7 +33,7 @@ Details at http://learn.iis.net/page.aspx/241/configuration-extensibility/
<attribute name="nodeProcessCommandLine" type="string" expanded="true" defaultValue="&quot;%programfiles%\nodejs\node.exe&quot;"/>
<attribute name="interceptor" type="string" expanded="true" defaultValue="&quot;%programfiles%\iisnode\interceptor.js&quot;" />
<attribute name="maxConcurrentRequestsPerProcess" type="uint" allowInfitnite="true" defaultValue="1024"/>
- <attribute name="maxNamedPipeConnectionRetry" type="uint" defaultValue="24"/>
+ <attribute name="maxNamedPipeConnectionRetry" type="uint" defaultValue="100"/>
<attribute name="namedPipeConnectionRetryDelay" type="uint" defaultValue="250"/>
<attribute name="maxNamedPipeConnectionPoolSize" type="uint" defaultValue="512"/>
<attribute name="maxNamedPipePooledConnectionAge" type="uint" defaultValue="30000"/>
@@ -33,7 +33,7 @@ Details at http://learn.iis.net/page.aspx/241/configuration-extensibility/
<attribute name="nodeProcessCommandLine" type="string" expanded="true" defaultValue="&quot;%programfiles(x86)%\nodejs\node.exe&quot;"/>
<attribute name="interceptor" type="string" expanded="true" defaultValue="&quot;%programfiles%\iisnode\interceptor.js&quot;" />
<attribute name="maxConcurrentRequestsPerProcess" type="uint" allowInfitnite="true" defaultValue="1024"/>
- <attribute name="maxNamedPipeConnectionRetry" type="uint" defaultValue="24"/>
+ <attribute name="maxNamedPipeConnectionRetry" type="uint" defaultValue="100"/>
<attribute name="namedPipeConnectionRetryDelay" type="uint" defaultValue="250"/>
<attribute name="maxNamedPipeConnectionPoolSize" type="uint" defaultValue="512"/>
<attribute name="maxNamedPipePooledConnectionAge" type="uint" defaultValue="30000"/>
@@ -33,7 +33,7 @@ Details at http://learn.iis.net/page.aspx/241/configuration-extensibility/
<attribute name="nodeProcessCommandLine" type="string" expanded="true" defaultValue="&quot;%programfiles(x86)%\nodejs\node.exe&quot;"/>
<attribute name="interceptor" type="string" expanded="true" defaultValue="&quot;%programfiles(x86)%\iisnode\interceptor.js&quot;" />
<attribute name="maxConcurrentRequestsPerProcess" type="uint" allowInfitnite="true" defaultValue="1024"/>
- <attribute name="maxNamedPipeConnectionRetry" type="uint" defaultValue="24"/>
+ <attribute name="maxNamedPipeConnectionRetry" type="uint" defaultValue="100"/>
<attribute name="namedPipeConnectionRetryDelay" type="uint" defaultValue="250"/>
<attribute name="maxNamedPipeConnectionPoolSize" type="uint" defaultValue="512"/>
<attribute name="maxNamedPipePooledConnectionAge" type="uint" defaultValue="30000"/>
@@ -35,6 +35,11 @@ CNodeProcess::~CNodeProcess()
}
}
+BOOL CNodeProcess::HasProcessExited()
+{
+ return this->hasProcessExited;
+}
+
HRESULT CNodeProcess::Initialize(IHttpContext* context)
{
HRESULT hr;
@@ -40,6 +40,7 @@ class CNodeProcess
void OnRequestCompleted(CNodeHttpStoredContext* context);
void SignalWhenDrained(HANDLE handle);
char* TryGetLog(IHttpContext* context, DWORD* size);
+ BOOL HasProcessExited();
};
#endif
@@ -656,6 +656,15 @@ void WINAPI CProtocolBridge::CreateNamedPipeConnection(DWORD error, DWORD bytesT
CProtocolBridge::SendEmptyResponse(ctx, 500, _T("Internal Server Error"), hr);
}
}
+ else if (ctx->GetNodeProcess()->HasProcessExited())
+ {
+ // the process has exited, likely due to initialization error
+ // stop trying to establish the named pipe connection to minimize the failure latency
+
+ ctx->GetNodeApplication()->GetApplicationManager()->GetEventProvider()->Log(
+ L"iisnode was unable to establish named pipe connection to the node.exe process before the process terminated", WINEVENT_LEVEL_ERROR, ctx->GetActivityId());
+ CProtocolBridge::SendEmptyResponse(ctx, 500, _T("Internal Server Error"), hr);
+ }
else
{
ctx->SetConnectionRetryCount(retry + 1);
@@ -31,7 +31,7 @@ maxConcurrentRequestsPerProcess: 1024
# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a
# node process in order to send a new HTTP request
-maxNamedPipeConnectionRetry: 24
+maxNamedPipeConnectionRetry: 100
# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries
@@ -148,7 +148,7 @@ <h2>
node_env="%node_env%"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
- maxNamedPipeConnectionRetry="24"
+ maxNamedPipeConnectionRetry="100"
namedPipeConnectionRetryDelay="250"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"
@@ -221,7 +221,7 @@ <h2>
# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a
# node process in order to send a new HTTP request
-maxNamedPipeConnectionRetry: 24
+maxNamedPipeConnectionRetry: 100
# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries
@@ -113,7 +113,7 @@
node_env="%node_env%"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
- maxNamedPipeConnectionRetry="24"
+ maxNamedPipeConnectionRetry="100"
namedPipeConnectionRetryDelay="250"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"

0 comments on commit 3efa757

Please sign in to comment.