Giter Club home page Giter Club logo

node-svmq's People

Contributors

jhead avatar kimnyholm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-svmq's Issues

receive mtype value with on data callback

Hi,

First of all thanks for the intresting project. One missing thing I have noticed is that mtype value is not provided on data event. It would be really useful to also know what was message type.

garbage received when sending many messages

assuming dumb sender:

'use strict'

import MessageQueue from 'svmq'

let app = {}

const APP_IPC_KEY       = 31337
const fromAPP   = 100
const toAPP     = 200

function start() {
 try {
  app = new MessageQueue(APP_IPC_KEY)
  app.send = (msg) => {
   app.push(Buffer.from(msg), { type: toAPP })
  }
  let q = 0;
  while(q++ < 100000)
    app.send('msg N' + q)
 } catch(e) {
    console.log('start failed : ' +  e.message)
 }
}

start()

and reciever:

'use strict'

import MessageQueue from 'svmq'

let app = {}

const APP_IPC_KEY       = 31337
const fromAPP   = 200
const toAPP     = 100

function start() {
 try {
  app = new MessageQueue(APP_IPC_KEY)
  app.on('data', (data) => {
   console.log('rcv: ' + data.toString())
  })
 } catch(e) {
    console.log('start failed : ' +  e.message)
 }
}

start()

receiver prints garbage to console

Int32Value() deprecated with node 12

When running npm install for node 12 you will get the following error:
../src/functions.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE GetMessageQueue(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/functions.cc:123:43: error: no matching function for call to ‘v8::Value::Int32Value()’ key_t key = (key_t) info[0]->Int32Value(); ^ In file included from /home/ubuntu/.cache/node-gyp/12.10.0/include/node/node.h:63:0, from ../node_modules/nan/nan.h:54, from ../src/functions.cc:1: /home/ubuntu/.cache/node-gyp/12.10.0/include/node/v8.h:2582:40: note: candidate: v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;

Fatal error in ../deps/v8/src/objects.cc, line 3577

Hi, thank you for the this IPC module. I have an issue with using it. I am trying communicate between my node server and a C program which is located in the same device. I am working with ARMv7 architecture. I am just trying to send a simple message to an id using your example code in readme. I am using Nodejs v8.11.4 and dont have npm in it. Getting packages with buildroot.
So the issue is that I am getting this fatal error

# Fatal error in ../deps/v8/src/objects.cc, line 3577
# Check failed: receiver->IsJSFunction().

when I try to run this code:

var msg = svmq.msg;
var MSGMAX = svmq.MSGMAX;
var id = msg.get(1, 950);
msg.snd(id, new Buffer('Hello World!'), 1, (err) => {
    if (err) throw err;
});

Is that about being compatible with versions or that I am working on a embedded device. Thanks for all!(btw I am submitting an issue for the first time so if I did something wrong please tell.)

Crash at sending of 6th message

The first 5 messages are sent without problems, but at the 6th the program completely crashes - not in the way a Node.js program normally exits with an error, but it seems to be the interpreter itself crashing:

node: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.
Aborted

This is under Node v7.9.0 on a Raspberry Pi 3 running Raspbian GNU/Linux 8.0 (jessie).

The behavior is reproducible: it's always at the 6th message. The first five arrive correctly. I think my code is according to the instructions: at the start of the program it does

var svmq = require('svmq');
var inqueue = new svmq(55809);
var sendarray = new Uint8Array(16);

and after that, each time a message must be sent, sendarray is populated with the right data, after which this is run:

inqueue.push(Buffer.from(sendarray), {type: 3}, (err) => {
    		if (err) console.log('Error: '+err);
    		else console.log('Command put on the message queue');
    	});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.