Skip to content

Commit

Permalink
fix #174: increase named pipe connection attempt default
Browse files Browse the repository at this point in the history
  • Loading branch information
tjanczuk committed Jun 26, 2012
1 parent 6bdc124 commit 3efa757
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/config/iisnode_schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
2 changes: 1 addition & 1 deletion src/config/iisnode_schema_x64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
2 changes: 1 addition & 1 deletion src/config/iisnode_schema_x64_wow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
5 changes: 5 additions & 0 deletions src/iisnode/cnodeprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ CNodeProcess::~CNodeProcess()
}
}

BOOL CNodeProcess::HasProcessExited()
{
return this->hasProcessExited;
}

HRESULT CNodeProcess::Initialize(IHttpContext* context)
{
HRESULT hr;
Expand Down
1 change: 1 addition & 0 deletions src/iisnode/cnodeprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class CNodeProcess
void OnRequestCompleted(CNodeHttpStoredContext* context);
void SignalWhenDrained(HANDLE handle);
char* TryGetLog(IHttpContext* context, DWORD* size);
BOOL HasProcessExited();
};

#endif
9 changes: 9 additions & 0 deletions src/iisnode/cprotocolbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/samples/configuration/iisnode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/samples/configuration/readme.htm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2>
node_env="%node_env%"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
maxNamedPipeConnectionRetry="24"
maxNamedPipeConnectionRetry="100"
namedPipeConnectionRetryDelay="250"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/samples/configuration/web.config
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
node_env="%node_env%"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
maxNamedPipeConnectionRetry="24"
maxNamedPipeConnectionRetry="100"
namedPipeConnectionRetryDelay="250"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"
Expand Down

0 comments on commit 3efa757

Please sign in to comment.