{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/body-parser/issues/126","labels_url":"https://api.github.com/repos/expressjs/body-parser/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/body-parser/issues/126/comments","events_url":"https://api.github.com/repos/expressjs/body-parser/issues/126/events","html_url":"https://github.com/expressjs/body-parser/issues/126","id":107226085,"number":126,"title":"UnsupportedMediaTypeError: unsupported charset \"UTF-8\" sometimes under high load","user":{"login":"JustinDrake","id":731743,"avatar_url":"https://avatars.githubusercontent.com/u/731743?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinDrake","html_url":"https://github.com/JustinDrake","followers_url":"https://api.github.com/users/JustinDrake/followers","following_url":"https://api.github.com/users/JustinDrake/following{/other_user}","gists_url":"https://api.github.com/users/JustinDrake/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinDrake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinDrake/subscriptions","organizations_url":"https://api.github.com/users/JustinDrake/orgs","repos_url":"https://api.github.com/users/JustinDrake/repos","events_url":"https://api.github.com/users/JustinDrake/events{/privacy}","received_events_url":"https://api.github.com/users/JustinDrake/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/expressjs/body-parser/labels/investigate","name":"investigate","color":"bfdadc"}],"state":"open","locked":false,"assignee":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-09-18T15:40:03Z","updated_at":"2015-09-28T03:39:03Z","closed_at":null,"body":"I am stress testing my NodeJS server under very high load. Surprisingly, the weakest link seems to be `body-parser`. Every once in a while I get these errors:\r\n\r\n```\r\nUnsupportedMediaTypeError: unsupported charset \"UTF-8\"\r\n    at /Users/justin/Desktop/Duo-Money/servers/node_modules/body-parser/lib/read.js:75:15\r\n    at done (/Users/justin/Desktop/Duo-Money/servers/node_modules/body-parser/node_modules/raw-body/index.js:239:14)\r\n    at /Users/justin/Desktop/Duo-Money/servers/node_modules/body-parser/node_modules/raw-body/index.js:217:7\r\n    at doNTCallback0 (node.js:407:9)\r\n    at process._tickCallback (node.js:336:13)\r\n```"},"comment":{"url":"https://api.github.com/repos/expressjs/body-parser/issues/comments/143632635","html_url":"https://github.com/expressjs/body-parser/issues/126#issuecomment-143632635","issue_url":"https://api.github.com/repos/expressjs/body-parser/issues/126","id":143632635,"user":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T03:39:03Z","updated_at":"2015-09-28T03:39:03Z","body":"Hi @JustinDrake , sorry for the delayed reply. I'm not 100% sure what the question is; you can always prevent it from polluting your console from simply not printing it to the console where ever the print is occurring.\r\n\r\nBut as for the actual root cause of your error, it is very likely that your fd limit on the process you are loading testing is just way too low. Typically the limit is not very high, and if you happen to be running the server of Mac OS X, then it's really, really low.\r\n\r\nThere are two solutions you can try to fix the root cause for an error like this in your application:\r\n\r\n1. Increase the file descriptor limit for your process, especially important if that process is running on Mac OS X. You should have this limit set to at least the number of parallel requests you are expecting your application to handle.\r\n2. Patch Node.js with a module like `graceful-fs` (https://github.com/isaacs/node-graceful-fs#global-patching), which will modify code Node.js to actually handle `EMFILE` errors in your application, rather than making them fatal."}}