Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

nodejs crashes with "Unknown system errno 31" #4246

Closed
greata134 opened this issue Nov 7, 2012 · 11 comments
Closed

nodejs crashes with "Unknown system errno 31" #4246

greata134 opened this issue Nov 7, 2012 · 11 comments

Comments

@greata134
Copy link

Have a small application to reproduce the issue (note that it's important to use umlaut characters in console.log, but this error apparently is NOT limited to console.log, but also occurs when other actions are performed against some values)

[CODE]
app.js:

var express = require('express');
GLOBAL.app = module.exports = express();
var server = require('http').createServer(app);
server.listen(3000, '127.0.0.1');

//App routes.
app.get('/', function (req, res) {
console.log("üöä");
});

[CODE2 - simplified]
app.js
console.log("üöä"); // Yes, it's a one-line app.js file that only does console.log call with some german characters in it

Now just navigate to http://127.0.0.1:3000 (code 1) or run app.js (CODE 2) and see

debugger listening on port 5858
Error: write Unknown system errno 31
at errnoException (net.js:769:11)
at Object.afterWrite (net.js:593:19)
debugger listening on port 5858

PS i used nodemon in debug mode, OS is Windows 7 x64 German

@piscisaureus
Copy link

For as much as it matters, this works fine here (although I didn't try nodemon).

"system errno 31" means:

ERROR_GEN_FAILURE

    31 (0x1F)

    A device attached to the system is not functioning.

@greata134
Copy link
Author

have just run in on a different system (English version of Win7 x64), now it crashes with
events.js: 68
throw arguments[1]; // Unhandled 'error' event

at errnoException (net.js:769:11)
at Object.afterWrite (net.js:593:19)

@greata134 greata134 reopened this Nov 7, 2012
@greata134
Copy link
Author

(edited) now Russian version of Windows 7 x64

//console.log("test");
console.log("ьцд");

this one crashes

console.log("test");
//console.log("ьцд");

this one works

NOTE that file is NOT saved as unicode, it's ansi coded text file (so looks like this)
0000000000: 2F 2F 63 6F 6E 73 6F 6C │ 65 2E 6C 6F 67 28 22 74 //console.log("t
0000000010: 65 73 74 22 29 3B 0D 0A │ 63 6F 6E 73 6F 6C 65 2E est");♪◙console.
0000000020: 6C 6F 67 28 22 FC F6 E4 │ 22 29 3B 0D 0A log("ьцд");♪◙

@piscisaureus
Copy link

Can't reproduce.

  • Which node version are you using?
  • Which nodemon command are you using to start your app.js (test case 2) ?
  • Do you use the standard windows console or something special (like console2) ?
  • Can you try whether this works -> console.log("\xfc\xfd\xff")
  • How is your app.js file encoded. UTF8?

@piscisaureus
Copy link

You should be aware that node can only load utf8 encoded javascript files (and files that contain only ascii characters of course).

@greata134
Copy link
Author

  1. The last scenario was done using node.exe (not nodemon), version 0.8.11

chcp 65001
node "app_bug.js"

  1. standard windows console. The same also crashes if i use sys.puts instead of console.log
  2. console.log("\xfc\xfd\xff") crashes too
  3. see above - ANSI encoding, just used 0xFC, 0xF6 0xE4 characters

@greata134
Copy link
Author

You should be aware that node can only load utf8 files (and files that contain only ascii characters of course).

The problem is: it's not the string literal i'm trying to manipulate, this data is loaded from database (using mysql module) and when we try to do something with the data, it crashes...

@piscisaureus
Copy link

Ok, I think you're seeing two different issues.

  • The russian file fails to run because it's not valid utf8. The same is true for the file that contains umlauts, when run at the windows console.
  • chcp 65001 is known to cause this issues. The same will happen if you create a file that has umlauts in it's name, and then run "dir" in that directory.

@piscisaureus
Copy link

Demo:

D:\>cd show

D:\show>echo. > hüöällo.txt

D:\show>chcp 65001
Active code page: 65001

D:\show>dir
 Volume in drive D is BOOTCAMP
 Volume Serial Number is 9ED5-A315

 Directory of D:\show

11/07/2012  10:47 AM    <DIR>          .
11/07/2012  10:47 AM    <DIR>          ..
The system cannot write to the specified device.

D:\show>

Change your console to use an unicode font (not a raster font) and it'll work.

@greata134
Copy link
Author

Thanks, that seems to be it!

@piscisaureus
Copy link

errno mapping added in joyent/libuv@f372fd4b13ce

richardlau pushed a commit to ibmruntimes/node that referenced this issue Jan 13, 2016
Fix: nodejs#4246
PR-URL: nodejs/node#4315
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants