Skip to content

Node crashes silently on disappearing ttyS0 #6

@jampy

Description

@jampy

Ok, this is a tough one, but I hope you can give me some hints. :)

I have an embedded ARM device that reserves four ttyS* devices in /dev;

~$ ls -al /dev/ttyS?
crw-rw----    1 root     dialout    4,  64 Jul  5 14:34 /dev/ttyS0
crw-rw----    1 root     dialout    4,  65 Jul  5 08:03 /dev/ttyS1
crw-rw----    1 root     dialout    4,  66 Jul  5 08:03 /dev/ttyS2
crw-rw----    1 root     dialout    4,  67 Jul  5 08:03 /dev/ttyS3

I have two different PCMCIA / CF cards that provide a serial port. Inserting one of these cards enables /dev/ttyS0.

Having the card inserted I run the following program:

require("daemon").start();
console.log("daemon mode ok");

var fs = require("fs");

setInterval(function() {
  console.log("alive.");
}, 1000);

fs.open("/dev/ttyS0", "r", 0666, function(err, fd) {
  if (err) {
    console.log("open() failed: ",err.message);
  } else {
    console.log("open() OK");
  }
});

The "alive." line is written continously until I remove the CF card. Then the Node.JS process dies silently.

Note the /dev/ttyS0 device file is there at all times. It changes it's mtime, though.

Node does not crash when the device is not open or when Node runs in foreground (not using the daemonplugin).

Do you have any idea what could be causing this? Especially, why does daemon make a difference here?

$ node -v
v0.4.8

$ uname -a
Linux nomad 2.6.26.7-sdg #15 Wed Sep 30 15:32:44 EDT 2009 armv5tel unknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions