Skip to content

Commit

Permalink
added npm version conflict section and moved http 5xx status table to…
Browse files Browse the repository at this point in the history
… above troubleshooting 5XXs
  • Loading branch information
Aldmar Joubert committed Feb 20, 2023
1 parent 370c403 commit 21e4377
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions _posts/2022-10-17-troubleshooting-common-iisnode-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,6 @@ The below screenshot shows how to enable application logging through the portal.
![Kudu Debug Console - view freb logs](/media/2022/08/failed-request-log-sample.png)


# IISNODE http status and substatus

The below table is referenced from:

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide#iisnode-http-status-and-substatus

| HTTP Status | HTTP Substatus | Possible reason? |
|-------------|----------------|------------------|
| 500 | 1000 | There was some issue dispatching the request to IISNODE – Check if node.exe was started. Node.exe could have crashed when starting. Check your web.config configuration for errors. |
| 500 | 1001 | - Win32Error 0x2 - App is not responding to the URL. Check the URL rewrite rules or check if your express app has the correct routes defined. - Win32Error 0x6d – named pipe is busy – Node.exe is not accepting requests because the pipe is busy. Check high cpu usage. - Other errors – check if node.exe crashed. |
| 500 | 1002 | Node.exe crashed – check d:\home\LogFiles\logging-errors.txt for stack trace. |
| 500 | 1003 | Pipe configuration Issue – The named pipe configuration is incorrect. |
| 500 | 1004-1018 | There was some error while sending the request or processing the response to/from node.exe. Check if node.exe crashed. check d:\home\LogFiles\logging-errors.txt for stack trace. |
| 503 | 1000 | Not enough memory to allocate more named pipe connections. Check why your app is consuming so much memory. Check maxConcurrentRequestsPerProcess setting value. If it's not infinite and you have many requests, increase this value to prevent this error. |
| 503 | 1001 | Request could not be dispatched to node.exe because the application is recycling. After the application has recycled, requests should be served normally. |
| 503 | 1002 | Check win32 error code for actual reason – Request could not be dispatched to a node.exe. |
| 503 | 1003 | Named pipe is too Busy – Verify if node.exe is consuming excessive CPU. |

# Troubleshooting Common Issues

## Hard coding the PORT
Expand Down Expand Up @@ -189,6 +171,38 @@ An example of an updated package.json start script file using PM2. Replace .bin/
```
To validate CPU usage, you can review the detectors under the App Service [Diagnose and Solve Problems](https://learn.microsoft.com/en-us/azure/app-service/overview-diagnostics) blade.

## NPM version conflict

If you run into an issue where you believe the conflict is due to the NPM version, you can test by updating the NPM version using the application setting <b>WEBSITE_NPM_DEFAULT_VERSION=desired-version</b>.

To validate the NPM version being used, you can run the below command within the SCM site debug console found here: <b>webapp-name.scm.azurewebsites.net/DebugConsole</b>

```sh
npm --version
```

To validate which versions of NPM are installed on your App Service plan, you can browse your application's SCM site and review the runtime versions here: <b>webapp-name.scm.azurewebsites.net/api/diagnostics/runtime</b>

Testing the behaviour locally to validate a conflict with a specific NPM version is best.

# IISNODE http status and substatus

The below table is referenced from:

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide#iisnode-http-status-and-substatus

| HTTP Status | HTTP Substatus | Possible reason? |
|-------------|----------------|------------------|
| 500 | 1000 | There was some issue dispatching the request to IISNODE – Check if node.exe was started. Node.exe could have crashed when starting. Check your web.config configuration for errors. |
| 500 | 1001 | - Win32Error 0x2 - App is not responding to the URL. Check the URL rewrite rules or check if your express app has the correct routes defined. - Win32Error 0x6d – named pipe is busy – Node.exe is not accepting requests because the pipe is busy. Check high cpu usage. - Other errors – check if node.exe crashed. |
| 500 | 1002 | Node.exe crashed – check d:\home\LogFiles\logging-errors.txt for stack trace. |
| 500 | 1003 | Pipe configuration Issue – The named pipe configuration is incorrect. |
| 500 | 1004-1018 | There was some error while sending the request or processing the response to/from node.exe. Check if node.exe crashed. check d:\home\LogFiles\logging-errors.txt for stack trace. |
| 503 | 1000 | Not enough memory to allocate more named pipe connections. Check why your app is consuming so much memory. Check maxConcurrentRequestsPerProcess setting value. If it's not infinite and you have many requests, increase this value to prevent this error. |
| 503 | 1001 | Request could not be dispatched to node.exe because the application is recycling. After the application has recycled, requests should be served normally. |
| 503 | 1002 | Check win32 error code for actual reason – Request could not be dispatched to a node.exe. |
| 503 | 1003 | Named pipe is too Busy – Verify if node.exe is consuming excessive CPU. |

# Troubleshooting 5xx Server Errors

If your application is returning a **HTTP 500 error**, the next place to look is the detailed errors within the **/home/LogFiles** directory. This will give you the **substatus code** and **win32 error code**, which can be used to help isolate the issue further. An example of the detailed error output can be observed in the next section.
Expand Down

0 comments on commit 21e4377

Please sign in to comment.