moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 507 forks source link

terminate called after throwing an instance of 'std::bad_alloc' #275

Closed whisher closed 9 years ago

whisher commented 9 years ago

Hi Matteo, first off great job :) I'm just playing around with mosca following getting started with mqtt when I run (localhost) this simple code:

var mosca = require('mosca')

var pubsubsettings = {
  type: 'mongo',
  url: 'mongodb://localhost:27017/mqtt',
  pubsubCollection: 'myCollections',
  mongo: {}
};

var settings = {
  port: 1883,
  backend: pubsubsettings
};

//here we start mosca
var server = new mosca.Server(settings);
server.on('ready', setup);

// fired when the mqtt server is ready
function setup() {
  console.log('Mosca server is up and running')
}

// fired whena  client is connected
server.on('clientConnected', function(client) {
  console.log('client connected', client.id);
});

// fired when a message is received
server.on('published', function(packet, client) {
  console.log('Published : ', packet.payload);
});

// fired when a client subscribes to a topic
server.on('subscribed', function(topic, client) {
  console.log('subscribed : ', topic);
});

// fired when a client subscribes to a topic
server.on('unsubscribed', function(topic, client) {
  console.log('unsubscribed : ', topic);
});

// fired when a client is disconnecting
server.on('clientDisconnecting', function(client) {
  console.log('clientDisconnecting : ', client.id);
});

// fired when a client is disconnected
server.on('clientDisconnected', function(client) {
  console.log('clientDisconnected : ', client.id);
});

I've got

Mosca server is up and running terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted

I've read this issue is due to a lack of memory but I've got 4GB ^^

So can you help me, please ?

Have a good day :)

mcollina commented 9 years ago

Which OS are you using? Which other applications are you running at the same time? Currently test.mosca.io runs in a VPS with 512MB of RAM, so definitely there is something else going on.

whisher commented 9 years ago

I'm on a Mint Rebecca Desktop.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   4596  1416 ?        Ss   08:45   0:01 /sbin/init
root         2  0.0  0.0      0     0 ?        S    08:45   0:00 [kthreadd]
root         3  0.7  0.0      0     0 ?        S    08:45   1:14 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    08:45   0:03 [rcu_sched]
root         8  0.0  0.0      0     0 ?        S    08:45   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/0]
root        10  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/0]
root        11  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/1]
root        12  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/1]
root        13  0.5  0.0      0     0 ?        S    08:45   0:58 [ksoftirqd/1]
root        14  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/1:0]
root        15  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/1:0H]
root        16  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/2]
root        17  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/2]
root        18  0.4  0.0      0     0 ?        S    08:45   0:43 [ksoftirqd/2]
root        20  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/2:0H]
root        21  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/3]
root        22  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/3]
root        23  0.4  0.0      0     0 ?        S    08:45   0:44 [ksoftirqd/3]
root        25  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/3:0H]
root        26  0.0  0.0      0     0 ?        S<   08:45   0:00 [khelper]
root        27  0.0  0.0      0     0 ?        S    08:45   0:00 [kdevtmpfs]
root        28  0.0  0.0      0     0 ?        S<   08:45   0:00 [netns]
root        29  0.0  0.0      0     0 ?        S<   08:45   0:00 [writeback]
root        30  0.0  0.0      0     0 ?        S<   08:45   0:00 [kintegrityd]
root        31  0.0  0.0      0     0 ?        S<   08:45   0:00 [bioset]
root        33  0.0  0.0      0     0 ?        S<   08:45   0:00 [kblockd]
root        34  0.0  0.0      0     0 ?        S<   08:45   0:00 [ata_sff]
root        35  0.0  0.0      0     0 ?        S    08:45   0:00 [khubd]
root        36  0.0  0.0      0     0 ?        S<   08:45   0:00 [md]
root        37  0.0  0.0      0     0 ?        S<   08:45   0:00 [devfreq_wq]
root        38  0.0  0.0      0     0 ?        S    08:45   0:03 [kworker/0:1]
root        40  0.0  0.0      0     0 ?        S    08:45   0:03 [kworker/2:1]
root        41  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/3:1]
root        42  0.0  0.0      0     0 ?        S    08:45   0:00 [khungtaskd]
root        43  0.1  0.0      0     0 ?        S    08:45   0:13 [kswapd0]
root        44  0.0  0.0      0     0 ?        SN   08:45   0:00 [ksmd]
root        45  0.0  0.0      0     0 ?        SN   08:45   0:02 [khugepaged]
root        46  0.0  0.0      0     0 ?        S    08:45   0:00 [fsnotify_mark]
root        47  0.0  0.0      0     0 ?        S    08:45   0:00 [ecryptfs-kthre
root        48  0.0  0.0      0     0 ?        S<   08:45   0:00 [crypto]
root        60  0.0  0.0      0     0 ?        S<   08:45   0:00 [kthrotld]
root        63  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_0]
root        64  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_1]
root        66  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_2]
root        67  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_3]
root        89  0.0  0.0      0     0 ?        S<   08:45   0:00 [deferwq]
root        90  0.0  0.0      0     0 ?        S<   08:45   0:00 [charger_manage
root        91  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/2:2]
root        92  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/0:2]
root       142  0.0  0.0      0     0 ?        S<   08:45   0:00 [kpsmoused]
root       172  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_4]
root       173  0.0  0.0      0     0 ?        S    08:45   0:00 [usb-storage]
root       250  0.0  0.0      0     0 ?        S    08:45   0:00 [jbd2/sda2-8]
root       251  0.0  0.0      0     0 ?        S<   08:45   0:00 [ext4-rsv-conve
root       373  0.0  0.0   3008   396 ?        S    08:45   0:00 upstart-udev-br
root       379  0.0  0.0  12488   448 ?        Ss   08:45   0:00 /lib/systemd/sy
root       482  0.0  0.0      0     0 ?        S<   08:45   0:00 [kvm-irqfd-clea
root       483  0.0  0.0      0     0 ?        S<   08:45   0:00 [kmpathd]
root       484  0.0  0.0      0     0 ?        S<   08:45   0:00 [kmpath_handler
root       566  0.0  0.0      0     0 ?        S<   08:45   0:00 [hd-audio0]
mosquit+   634  0.0  0.0   2508   460 ?        Ss   08:45   0:00 /usr/sbin/mosqu
root       651  0.0  0.0   2868   248 ?        S    08:45   0:00 upstart-socket-
root       782  0.0  0.0  28404  1396 ?        Ss   08:45   0:00 smbd -F
root       822  0.0  0.0   2880   248 ?        S    08:45   0:00 upstart-file-br
syslog     881  0.0  0.0  31368   592 ?        Ssl  08:45   0:00 rsyslogd
message+   914  0.0  0.0   4768  1268 ?        Ss   08:45   0:00 dbus-daemon --s
root       927  0.0  0.0  38380   964 ?        Ssl  08:45   0:00 /usr/sbin/Modem
root       941  0.0  0.0   4876   804 ?        Ss   08:45   0:00 /usr/sbin/bluet
root       953  0.0  0.0   4212   756 ?        Ss   08:45   0:00 /lib/systemd/sy
avahi      963  0.0  0.0   3472   568 ?        S    08:45   0:00 avahi-daemon: r
avahi      965  0.0  0.0   3472   120 ?        S    08:45   0:00 avahi-daemon: c
root       971  0.0  0.0      0     0 ?        S<   08:45   0:00 [krfcommd]
root       984  0.0  0.0  53136  3840 ?        Ssl  08:45   0:00 NetworkManager
root       987  0.0  0.0  28404  1116 ?        S    08:45   0:00 smbd -F
root       993  0.0  0.0  36028  1100 ?        Sl   08:45   0:00 /usr/lib/policy
root      1011  0.0  0.0   5508   416 ?        S    08:45   0:00 /sbin/dhclient 
nobody    1035  0.0  0.0   5548   756 ?        S    08:45   0:00 /usr/sbin/dnsma
root      1225  0.0  0.0  17368   636 ?        Ss   08:45   0:00 nmbd -D
root      1412  0.0  0.0   4644   372 tty4     Ss+  08:45   0:00 /sbin/getty -8 
root      1414  0.0  0.0   4644   372 tty5     Ss+  08:45   0:00 /sbin/getty -8 
root      1421  0.0  0.0   4644   372 tty2     Ss+  08:45   0:00 /sbin/getty -8 
root      1422  0.0  0.0   4644   372 tty3     Ss+  08:45   0:00 /sbin/getty -8 
root      1426  0.0  0.0   4644   372 tty6     Ss+  08:45   0:00 /sbin/getty -8 
root      1463  0.0  0.0   2192   352 ?        Ss   08:45   0:00 acpid -c /etc/a
root      1464  0.0  0.0   3052   432 ?        Ss   08:45   0:00 cron
root      1467  0.0  0.0   8700   788 ?        Ss   08:45   0:00 /usr/sbin/cups-
mongodb   1488  0.1  0.4 1859072 17896 ?       Ssl  08:45   0:12 /usr/bin/mongod
root      1585  0.0  0.0   3976   492 ?        Ss   08:45   0:00 /usr/sbin/irqba
kernoops  1632  0.0  0.0   6384   544 ?        Ss   08:45   0:00 /usr/sbin/kerne
root      1643  0.0  0.0  20912  1056 ?        Ss   08:45   0:00 mdm
redis     1651  0.0  0.0  27864  3080 ?        Ssl  08:45   0:01 /usr/bin/redis-
root      1673  0.0  0.0      0     0 ?        S<   08:45   0:00 [iprt]
mysql     1713  0.0  0.2 320460  8676 ?        Ssl  08:45   0:03 /usr/sbin/mysql
root      1887  0.0  0.0 109536  1700 ?        Ss   08:46   0:00 /usr/sbin/apach
root      1982  0.0  0.0   4644   372 tty1     Ss+  08:46   0:00 /sbin/getty -8 
root      2035  0.0  0.0  24128  1324 ?        S    08:46   0:00 mdm
root      2102  9.9  2.7 269496 111996 tty7    Ss+  08:46  16:04 /usr/bin/X :0 -
mdm       2164  0.0  0.0   3848   188 ?        S    08:46   0:00 dbus-launch --a
mdm       2173  0.0  0.0   4232   480 ?        Ss   08:46   0:00 //bin/dbus-daem
root      2208  0.0  0.0      0     0 ?        S    08:48   0:00 [kauditd]
whisher   2213  0.0  0.0  46116  1276 ?        Sl   08:49   0:00 /usr/bin/gnome-
root      2218  0.0  0.0  34864  1296 ?        Sl   08:49   0:00 /usr/sbin/conso
whisher   2289  0.0  0.0  49740  2744 ?        Ssl  08:49   0:00 x-session-manag
whisher   2478  0.0  0.0   4212    24 ?        Ss   08:49   0:00 /usr/bin/ssh-ag
whisher   2481  0.0  0.0   3848   200 ?        S    08:49   0:00 /usr/bin/dbus-l
whisher   2482  0.0  0.0   4628  1340 ?        Ss   08:49   0:00 //bin/dbus-daem
whisher   2555  0.0  0.0  24508  1524 ?        Sl   08:49   0:00 /usr/lib/dconf/
whisher   2562  0.0  0.0 159896  4112 ?        Sl   08:49   0:00 /usr/bin/mate-s
whisher   2564  0.0  0.2 222052 10240 ?        Sl   08:49   0:03 marco
whisher   2569  0.0  0.1 237176  4728 ?        Sl   08:49   0:00 mate-panel
whisher   2573  0.0  0.0  27752  1528 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
whisher   2578  0.0  0.0   2264   236 ?        S    08:49   0:00 /bin/sh /usr/bi
whisher   2582  0.0  0.0  44376   812 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
whisher   2594  0.8  0.0 166020  4056 ?        S<l  08:49   1:17 /usr/bin/pulsea
whisher   2597  0.0  0.3 278700 15596 ?        Sl   08:49   0:03 /usr/bin/python
rtkit     2598  0.0  0.0  21360   644 ?        SNl  08:49   0:00 /usr/lib/rtkit/
whisher   2601  0.0  0.1 317872  5784 ?        Sl   08:49   0:01 caja -n
whisher   2603  0.1  0.2 229056  9416 ?        Sl   08:49   0:09 /usr/lib/mate-p
whisher   2605  0.0  0.1 237616  5240 ?        Sl   08:49   0:00 /usr/lib/mate-p
whisher   2607  0.0  0.0 212888  3732 ?        Sl   08:49   0:00 /usr/lib/mate-p
whisher   2626  0.0  0.1 275784  5548 ?        Sl   08:49   0:00 mate-volume-con
whisher   2634  0.0  0.1 258528  4304 ?        Sl   08:49   0:00 nm-applet
whisher   2638  0.0  0.1  41368  4372 ?        Sl   08:49   0:00 mate-power-mana
whisher   2642  0.0  0.0  29796  1544 ?        Sl   08:49   0:00 /usr/lib/i386-l
whisher   2644  0.0  0.0  35492  2376 ?        Sl   08:49   0:00 /usr/bin/python
whisher   2647  0.0  0.2  83560 11336 ?        Sl   08:49   0:01 mate-screensave
root      2657  0.0  0.0  37824  1684 ?        Sl   08:49   0:00 /usr/lib/upower
whisher   2664  0.0  0.0  47108  1332 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
whisher   2710  0.0  0.0  44636  1000 ?        Sl   08:49   0:00 /usr/lib/at-spi
whisher   2714  0.0  0.0   4232   800 ?        S    08:49   0:00 /bin/dbus-daemo
whisher   2729  0.0  0.0  17360  1336 ?        Sl   08:49   0:00 /usr/lib/at-spi
whisher   2848  0.0  0.0   9728  1432 ?        S    08:49   0:00 /usr/lib/i386-l
whisher   2878  0.0  0.0  38696  2112 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
root      2882  0.0  0.0  53636  2112 ?        Sl   08:49   0:01 /usr/lib/udisks
root      2888  0.0  0.0  25656  1220 ?        Sl   08:49   0:00 /usr/sbin/syste
whisher   2893  0.0  0.0  39364   912 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
whisher   2903  0.0  0.0  28436  1048 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
whisher   2908  0.0  0.0  27192  3064 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
whisher   2932  0.0  0.0  19104  1944 ?        Sl   08:49   0:00 /usr/lib/gvfs/g
root      2938  0.0  0.0  16020  1832 ?        S    08:49   0:00 /usr/bin/perl /
whisher   2955  0.0  0.0   9328   520 ?        S    08:49   0:00 /usr/bin/python
whisher   2958  0.0  0.0   2264   236 ?        S    08:49   0:00 sh -c /usr/lib/
whisher   2959  0.0  0.2 244580 12168 ?        Sl   08:49   0:00 /usr/bin/python
www-data  3190  0.0  0.1 112892  5088 ?        S    08:51   0:00 /usr/sbin/apach
www-data  3191  0.0  0.0 109916  2024 ?        S    08:51   0:00 /usr/sbin/apach
www-data  3192  0.0  0.0 112584  4120 ?        S    08:51   0:00 /usr/sbin/apach
www-data  3193  0.0  0.0 109584  1776 ?        S    08:51   0:00 /usr/sbin/apach
www-data  3194  0.0  0.0 109568  1124 ?        S    08:51   0:00 /usr/sbin/apach
root      3267  0.0  0.0   8076  1300 ?        Ss   08:51   0:00 /usr/sbin/cupsd
root      3352  0.0  0.0      0     0 ?        S    09:00   0:00 [kworker/u8:1]
whisher   3373  4.1 10.7 1272216 442952 ?      Sl   09:02   6:02 /opt/sublime_te
whisher   3381  2.0  0.2  71952 10144 ?        Sl   09:02   2:54 /opt/sublime_te
whisher   3428  0.0  0.3 241160 14948 ?        Rl   09:02   0:05 mate-terminal
whisher   3434  0.0  0.0   2416   528 ?        S    09:03   0:00 gnome-pty-helpe
whisher   3435  0.0  0.0   7680  1816 pts/2    Ss+  09:03   0:00 bash
whisher   3581  0.0  0.4 285100 17916 ?        Sl   09:03   0:07 pluma
whisher   3590  7.6 11.4 1396892 475068 ?      Sl   09:03  11:04 firefox
whisher   3690  0.0  0.0   5304   464 ?        S    09:04   0:00 bash /usr/bin/b
whisher   3695  2.4  1.1 454944 48184 ?        Sl   09:04   3:28 banshee /usr/li
whisher   3716  3.0  3.2 1032368 135016 ?      Sl   09:05   4:16 /opt/google/chr
whisher   3723  0.0  0.0   4248   268 ?        S    09:05   0:00 cat
whisher   3724  0.0  0.0   4248   240 ?        S    09:05   0:00 cat
whisher   3727  0.0  0.0 187356  4080 ?        S    09:05   0:00 /opt/google/chr
whisher   3730  0.0  0.0  19940   644 ?        S    09:05   0:00 /opt/google/chr
whisher   3733  0.0  0.0 195552  2556 ?        S    09:05   0:00 /opt/google/chr
whisher   3749  1.3  4.2 532872 177324 ?       Sl   09:05   1:55 /opt/google/chr
whisher   3753  0.0  0.1 193616  7656 ?        S    09:05   0:00 /opt/google/chr
whisher   3775  0.0  0.2 301896 12056 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3785  0.0  0.4 325756 16892 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3789  1.2  1.1 345472 47968 ?        Sl   09:05   1:43 /opt/google/chr
whisher   3800  0.0  0.4 312140 18652 ?        Sl   09:05   0:05 /opt/google/chr
whisher   3806  0.0  0.3 313164 13420 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3810  0.0  0.2 305992 11840 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3815  0.0  0.2 301896 11872 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3820  0.0  0.5 340356 24732 ?        Sl   09:05   0:08 /opt/google/chr
whisher   3825  0.0  0.3 319312 15440 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3830  0.0  0.3 310388 15592 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3835  0.0  0.2 301896 12004 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3839  0.0  0.2 302920 12188 ?        Sl   09:05   0:00 /opt/google/chr
whisher   3844  0.3  0.8 347264 35004 ?        Sl   09:05   0:28 /opt/google/chr
whisher   3855  0.0  0.5 326484 21236 ?        Sl   09:05   0:01 /opt/google/chr
whisher   3932  2.4  4.4 604956 185624 ?       Sl   09:05   3:24 /opt/google/chr
whisher   3958  0.2  1.3 376624 57492 ?        Sl   09:05   0:23 /opt/google/chr
whisher   3985  0.0  0.5 353612 22076 ?        Sl   09:05   0:00 /opt/google/chr
whisher   4026  0.0  1.0 360116 43920 ?        Sl   09:06   0:04 /opt/google/chr
whisher   4038  0.2  0.5 294912 21868 ?        Sl   09:06   0:20 /opt/google/chr
whisher   4078  0.0  0.7 361620 31960 ?        Sl   09:06   0:03 /opt/google/chr
whisher   4094  0.1  1.1 383820 45740 ?        Sl   09:06   0:10 /opt/google/chr
whisher   4107  0.0  0.6 368656 25160 ?        Sl   09:06   0:01 /opt/google/chr
whisher   4134  0.3  1.3 407492 57884 ?        Sl   09:06   0:30 /opt/google/chr
whisher   4148  0.0  0.4 327784 19192 ?        Sl   09:06   0:00 /opt/google/chr
whisher   4163  0.0  0.4 333880 19648 ?        Sl   09:06   0:00 /opt/google/chr
whisher   4175  0.0  0.4 361872 19336 ?        Sl   09:06   0:01 /opt/google/chr
whisher   4185  0.0  0.8 367848 35256 ?        Sl   09:06   0:02 /opt/google/chr
whisher   4210  0.0  1.5 431152 63724 ?        Sl   09:06   0:02 /opt/google/chr
whisher   4219  0.0  0.5 349880 24732 ?        Sl   09:06   0:01 /opt/google/chr
whisher   4257  0.0  0.9 359436 37700 ?        Sl   09:06   0:02 /opt/google/chr
www-data  4275  0.0  0.0 109568  1236 ?        S    09:06   0:00 /usr/sbin/apach
whisher   4284  0.0  1.0 351812 43796 ?        Sl   09:06   0:03 /opt/google/chr
whisher   4298  0.3  1.7 437344 73880 ?        Sl   09:06   0:31 /opt/google/chr
whisher   4310  2.5  8.1 700704 338820 ?       Sl   09:06   3:37 /opt/google/chr
www-data  4341  0.0  0.0 109568  1268 ?        S    09:07   0:00 /usr/sbin/apach
www-data  4352  0.0  0.0 109568  1276 ?        S    09:07   0:00 /usr/sbin/apach
whisher   4840  0.3  2.4 504672 101528 ?       Sl   09:27   0:26 /opt/google/chr
whisher   4866  0.2  2.1 481120 88156 ?        Sl   09:27   0:15 /opt/google/chr
whisher   4979  1.0  1.5 314700 64532 ?        Sl   09:32   1:15 /opt/firefox34.
root      5161  0.0  0.0      0     0 ?        S    09:44   0:02 [kworker/1:2]
whisher   5250  0.4  2.5 434000 104372 ?       Sl   09:51   0:25 /opt/google/chr
whisher   5337  0.0  0.0   7680  3712 pts/3    Ss   09:56   0:00 bash
whisher   7176 12.5  0.8 272356 34924 ?        Sl   10:04  10:25 mate-system-mon
whisher   7231  0.0  0.0   7680  3108 pts/4    Ss   10:07   0:00 bash
root      7450  0.0  0.0      0     0 ?        S    10:12   0:00 [kworker/u8:3]
whisher   7724  0.4  2.5 414028 106076 ?       Sl   10:23   0:18 /opt/google/chr
whisher   7768  0.0  2.0 404508 83556 ?        Sl   10:24   0:03 /opt/google/chr
root      7891  0.0  0.0      0     0 ?        S    10:34   0:01 [kworker/3:2]
root      7991  0.0  0.0      0     0 ?        S    10:39   0:00 [kworker/u8:2]
root      8140  0.0  0.0      0     0 ?        S<   10:49   0:00 [kworker/u9:2]
whisher   8445  0.0  0.7  81216 31236 pts/4    Sl+  11:01   0:00 node server1.js
root      8458  0.0  0.0      0     0 ?        S<   11:01   0:00 [kworker/u9:0]
root      8519  0.0  0.0      0     0 ?        S    11:11   0:00 [kworker/u8:4]
whisher   8676  0.1  0.4  71588 16560 pts/3    Sl+  11:23   0:00 node client2.js
whisher   8689  0.0  0.1   7680  4144 pts/9    Ss   11:23   0:00 bash
root      8826  0.0  0.0      0     0 ?        S<   11:23   0:00 [kworker/u9:1]
root      8847  0.0  0.0      0     0 ?        S    11:25   0:00 [kworker/u8:0]
whisher   8868  2.2  1.5 359644 63212 ?        Sl   11:25   0:02 /opt/google/chr
whisher   8915  0.0  0.0   5224  1180 pts/9    R+   11:27   0:00 ps -aux

btw with redis it works fine.

Thanks for the quick reply.

mcollina commented 9 years ago

which version of node.js are you running? what are client2 and server1, that I can see in your ps report?

BTW, it seems you are running out of memory, if we count that you have LOTS of tabs of Chrome open, firefox, apache and mongodb.

Finally, it seems you are running mosquitto on your system, which means you need to change the Mosca port, or you won't be able to start it.

Il giorno dom 14 giu 2015 alle ore 11:30 Bedini Fabio aka whisher < notifications@github.com> ha scritto:

I'm on a Mint Rebecca Desktop.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 4596 1416 ? Ss 08:45 0:01 /sbin/init root 2 0.0 0.0 0 0 ? S 08:45 0:00 [kthreadd] root 3 0.7 0.0 0 0 ? S 08:45 1:14 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S< 08:45 0:00 [kworker/0:0H] root 7 0.0 0.0 0 0 ? S 08:45 0:03 [rcu_sched] root 8 0.0 0.0 0 0 ? S 08:45 0:00 [rcu_bh] root 9 0.0 0.0 0 0 ? S 08:45 0:00 [migration/0] root 10 0.0 0.0 0 0 ? S 08:45 0:00 [watchdog/0] root 11 0.0 0.0 0 0 ? S 08:45 0:00 [watchdog/1] root 12 0.0 0.0 0 0 ? S 08:45 0:00 [migration/1] root 13 0.5 0.0 0 0 ? S 08:45 0:58 [ksoftirqd/1] root 14 0.0 0.0 0 0 ? S 08:45 0:00 [kworker/1:0] root 15 0.0 0.0 0 0 ? S< 08:45 0:00 [kworker/1:0H] root 16 0.0 0.0 0 0 ? S 08:45 0:00 [watchdog/2] root 17 0.0 0.0 0 0 ? S 08:45 0:00 [migration/2] root 18 0.4 0.0 0 0 ? S 08:45 0:43 [ksoftirqd/2] root 20 0.0 0.0 0 0 ? S< 08:45 0:00 [kworker/2:0H] root 21 0.0 0.0 0 0 ? S 08:45 0:00 [watchdog/3] root 22 0.0 0.0 0 0 ? S 08:45 0:00 [migration/3] root 23 0.4 0.0 0 0 ? S 08:45 0:44 [ksoftirqd/3] root 25 0.0 0.0 0 0 ? S< 08:45 0:00 [kworker/3:0H] root 26 0.0 0.0 0 0 ? S< 08:45 0:00 [khelper] root 27 0.0 0.0 0 0 ? S 08:45 0:00 [kdevtmpfs] root 28 0.0 0.0 0 0 ? S< 08:45 0:00 [netns] root 29 0.0 0.0 0 0 ? S< 08:45 0:00 [writeback] root 30 0.0 0.0 0 0 ? S< 08:45 0:00 [kintegrityd] root 31 0.0 0.0 0 0 ? S< 08:45 0:00 [bioset] root 33 0.0 0.0 0 0 ? S< 08:45 0:00 [kblockd] root 34 0.0 0.0 0 0 ? S< 08:45 0:00 [ata_sff] root 35 0.0 0.0 0 0 ? S 08:45 0:00 [khubd] root 36 0.0 0.0 0 0 ? S< 08:45 0:00 [md] root 37 0.0 0.0 0 0 ? S< 08:45 0:00 [devfreq_wq] root 38 0.0 0.0 0 0 ? S 08:45 0:03 [kworker/0:1] root 40 0.0 0.0 0 0 ? S 08:45 0:03 [kworker/2:1] root 41 0.0 0.0 0 0 ? S 08:45 0:00 [kworker/3:1] root 42 0.0 0.0 0 0 ? S 08:45 0:00 [khungtaskd] root 43 0.1 0.0 0 0 ? S 08:45 0:13 [kswapd0] root 44 0.0 0.0 0 0 ? SN 08:45 0:00 [ksmd] root 45 0.0 0.0 0 0 ? SN 08:45 0:02 [khugepaged] root 46 0.0 0.0 0 0 ? S 08:45 0:00 [fsnotify_mark] root 47 0.0 0.0 0 0 ? S 08:45 0:00 [ecryptfs-kthre root 48 0.0 0.0 0 0 ? S< 08:45 0:00 [crypto] root 60 0.0 0.0 0 0 ? S< 08:45 0:00 [kthrotld] root 63 0.0 0.0 0 0 ? S 08:45 0:00 [scsi_eh_0] root 64 0.0 0.0 0 0 ? S 08:45 0:00 [scsi_eh_1] root 66 0.0 0.0 0 0 ? S 08:45 0:00 [scsi_eh_2] root 67 0.0 0.0 0 0 ? S 08:45 0:00 [scsi_eh_3] root 89 0.0 0.0 0 0 ? S< 08:45 0:00 [deferwq] root 90 0.0 0.0 0 0 ? S< 08:45 0:00 [charger_manage root 91 0.0 0.0 0 0 ? S 08:45 0:00 [kworker/2:2] root 92 0.0 0.0 0 0 ? S 08:45 0:00 [kworker/0:2] root 142 0.0 0.0 0 0 ? S< 08:45 0:00 [kpsmoused] root 172 0.0 0.0 0 0 ? S 08:45 0:00 [scsi_eh_4] root 173 0.0 0.0 0 0 ? S 08:45 0:00 [usb-storage] root 250 0.0 0.0 0 0 ? S 08:45 0:00 [jbd2/sda2-8] root 251 0.0 0.0 0 0 ? S< 08:45 0:00 [ext4-rsv-conve root 373 0.0 0.0 3008 396 ? S 08:45 0:00 upstart-udev-br root 379 0.0 0.0 12488 448 ? Ss 08:45 0:00 /lib/systemd/sy root 482 0.0 0.0 0 0 ? S< 08:45 0:00 [kvm-irqfd-clea root 483 0.0 0.0 0 0 ? S< 08:45 0:00 [kmpathd] root 484 0.0 0.0 0 0 ? S< 08:45 0:00 [kmpath_handler root 566 0.0 0.0 0 0 ? S< 08:45 0:00 [hd-audio0] mosquit+ 634 0.0 0.0 2508 460 ? Ss 08:45 0:00 /usr/sbin/mosqu root 651 0.0 0.0 2868 248 ? S 08:45 0:00 upstart-socket- root 782 0.0 0.0 28404 1396 ? Ss 08:45 0:00 smbd -F root 822 0.0 0.0 2880 248 ? S 08:45 0:00 upstart-file-br syslog 881 0.0 0.0 31368 592 ? Ssl 08:45 0:00 rsyslogd message+ 914 0.0 0.0 4768 1268 ? Ss 08:45 0:00 dbus-daemon --s root 927 0.0 0.0 38380 964 ? Ssl 08:45 0:00 /usr/sbin/Modem root 941 0.0 0.0 4876 804 ? Ss 08:45 0:00 /usr/sbin/bluet root 953 0.0 0.0 4212 756 ? Ss 08:45 0:00 /lib/systemd/sy avahi 963 0.0 0.0 3472 568 ? S 08:45 0:00 avahi-daemon: r avahi 965 0.0 0.0 3472 120 ? S 08:45 0:00 avahi-daemon: c root 971 0.0 0.0 0 0 ? S< 08:45 0:00 [krfcommd] root 984 0.0 0.0 53136 3840 ? Ssl 08:45 0:00 NetworkManager root 987 0.0 0.0 28404 1116 ? S 08:45 0:00 smbd -F root 993 0.0 0.0 36028 1100 ? Sl 08:45 0:00 /usr/lib/policy root 1011 0.0 0.0 5508 416 ? S 08:45 0:00 /sbin/dhclient nobody 1035 0.0 0.0 5548 756 ? S 08:45 0:00 /usr/sbin/dnsma root 1225 0.0 0.0 17368 636 ? Ss 08:45 0:00 nmbd -D root 1412 0.0 0.0 4644 372 tty4 Ss+ 08:45 0:00 /sbin/getty -8 root 1414 0.0 0.0 4644 372 tty5 Ss+ 08:45 0:00 /sbin/getty -8 root 1421 0.0 0.0 4644 372 tty2 Ss+ 08:45 0:00 /sbin/getty -8 root 1422 0.0 0.0 4644 372 tty3 Ss+ 08:45 0:00 /sbin/getty -8 root 1426 0.0 0.0 4644 372 tty6 Ss+ 08:45 0:00 /sbin/getty -8 root 1463 0.0 0.0 2192 352 ? Ss 08:45 0:00 acpid -c /etc/a root 1464 0.0 0.0 3052 432 ? Ss 08:45 0:00 cron root 1467 0.0 0.0 8700 788 ? Ss 08:45 0:00 /usr/sbin/cups- mongodb 1488 0.1 0.4 1859072 17896 ? Ssl 08:45 0:12 /usr/bin/mongod root 1585 0.0 0.0 3976 492 ? Ss 08:45 0:00 /usr/sbin/irqba kernoops 1632 0.0 0.0 6384 544 ? Ss 08:45 0:00 /usr/sbin/kerne root 1643 0.0 0.0 20912 1056 ? Ss 08:45 0:00 mdm redis 1651 0.0 0.0 27864 3080 ? Ssl 08:45 0:01 /usr/bin/redis- root 1673 0.0 0.0 0 0 ? S< 08:45 0:00 [iprt] mysql 1713 0.0 0.2 320460 8676 ? Ssl 08:45 0:03 /usr/sbin/mysql root 1887 0.0 0.0 109536 1700 ? Ss 08:46 0:00 /usr/sbin/apach root 1982 0.0 0.0 4644 372 tty1 Ss+ 08:46 0:00 /sbin/getty -8 root 2035 0.0 0.0 24128 1324 ? S 08:46 0:00 mdm root 2102 9.9 2.7 269496 111996 tty7 Ss+ 08:46 16:04 /usr/bin/X :0 - mdm 2164 0.0 0.0 3848 188 ? S 08:46 0:00 dbus-launch --a mdm 2173 0.0 0.0 4232 480 ? Ss 08:46 0:00 //bin/dbus-daem root 2208 0.0 0.0 0 0 ? S 08:48 0:00 [kauditd] whisher 2213 0.0 0.0 46116 1276 ? Sl 08:49 0:00 /usr/bin/gnome- root 2218 0.0 0.0 34864 1296 ? Sl 08:49 0:00 /usr/sbin/conso whisher 2289 0.0 0.0 49740 2744 ? Ssl 08:49 0:00 x-session-manag whisher 2478 0.0 0.0 4212 24 ? Ss 08:49 0:00 /usr/bin/ssh-ag whisher 2481 0.0 0.0 3848 200 ? S 08:49 0:00 /usr/bin/dbus-l whisher 2482 0.0 0.0 4628 1340 ? Ss 08:49 0:00 //bin/dbus-daem whisher 2555 0.0 0.0 24508 1524 ? Sl 08:49 0:00 /usr/lib/dconf/ whisher 2562 0.0 0.0 159896 4112 ? Sl 08:49 0:00 /usr/bin/mate-s whisher 2564 0.0 0.2 222052 10240 ? Sl 08:49 0:03 marco whisher 2569 0.0 0.1 237176 4728 ? Sl 08:49 0:00 mate-panel whisher 2573 0.0 0.0 27752 1528 ? Sl 08:49 0:00 /usr/lib/gvfs/g whisher 2578 0.0 0.0 2264 236 ? S 08:49 0:00 /bin/sh /usr/bi whisher 2582 0.0 0.0 44376 812 ? Sl 08:49 0:00 /usr/lib/gvfs/g whisher 2594 0.8 0.0 166020 4056 ? S<l 08:49 1:17 /usr/bin/pulsea whisher 2597 0.0 0.3 278700 15596 ? Sl 08:49 0:03 /usr/bin/python rtkit 2598 0.0 0.0 21360 644 ? SNl 08:49 0:00 /usr/lib/rtkit/ whisher 2601 0.0 0.1 317872 5784 ? Sl 08:49 0:01 caja -n whisher 2603 0.1 0.2 229056 9416 ? Sl 08:49 0:09 /usr/lib/mate-p whisher 2605 0.0 0.1 237616 5240 ? Sl 08:49 0:00 /usr/lib/mate-p whisher 2607 0.0 0.0 212888 3732 ? Sl 08:49 0:00 /usr/lib/mate-p whisher 2626 0.0 0.1 275784 5548 ? Sl 08:49 0:00 mate-volume-con whisher 2634 0.0 0.1 258528 4304 ? Sl 08:49 0:00 nm-applet whisher 2638 0.0 0.1 41368 4372 ? Sl 08:49 0:00 mate-power-mana whisher 2642 0.0 0.0 29796 1544 ? Sl 08:49 0:00 /usr/lib/i386-l whisher 2644 0.0 0.0 35492 2376 ? Sl 08:49 0:00 /usr/bin/python whisher 2647 0.0 0.2 83560 11336 ? Sl 08:49 0:01 mate-screensave root 2657 0.0 0.0 37824 1684 ? Sl 08:49 0:00 /usr/lib/upower whisher 2664 0.0 0.0 47108 1332 ? Sl 08:49 0:00 /usr/lib/gvfs/g whisher 2710 0.0 0.0 44636 1000 ? Sl 08:49 0:00 /usr/lib/at-spi whisher 2714 0.0 0.0 4232 800 ? S 08:49 0:00 /bin/dbus-daemo whisher 2729 0.0 0.0 17360 1336 ? Sl 08:49 0:00 /usr/lib/at-spi whisher 2848 0.0 0.0 9728 1432 ? S 08:49 0:00 /usr/lib/i386-l whisher 2878 0.0 0.0 38696 2112 ? Sl 08:49 0:00 /usr/lib/gvfs/g root 2882 0.0 0.0 53636 2112 ? Sl 08:49 0:01 /usr/lib/udisks root 2888 0.0 0.0 25656 1220 ? Sl 08:49 0:00 /usr/sbin/syste whisher 2893 0.0 0.0 39364 912 ? Sl 08:49 0:00 /usr/lib/gvfs/g whisher 2903 0.0 0.0 28436 1048 ? Sl 08:49 0:00 /usr/lib/gvfs/g whisher 2908 0.0 0.0 27192 3064 ? Sl 08:49 0:00 /usr/lib/gvfs/g whisher 2932 0.0 0.0 19104 1944 ? Sl 08:49 0:00 /usr/lib/gvfs/g root 2938 0.0 0.0 16020 1832 ? S 08:49 0:00 /usr/bin/perl / whisher 2955 0.0 0.0 9328 520 ? S 08:49 0:00 /usr/bin/python whisher 2958 0.0 0.0 2264 236 ? S 08:49 0:00 sh -c /usr/lib/ whisher 2959 0.0 0.2 244580 12168 ? Sl 08:49 0:00 /usr/bin/python www-data 3190 0.0 0.1 112892 5088 ? S 08:51 0:00 /usr/sbin/apach www-data 3191 0.0 0.0 109916 2024 ? S 08:51 0:00 /usr/sbin/apach www-data 3192 0.0 0.0 112584 4120 ? S 08:51 0:00 /usr/sbin/apach www-data 3193 0.0 0.0 109584 1776 ? S 08:51 0:00 /usr/sbin/apach www-data 3194 0.0 0.0 109568 1124 ? S 08:51 0:00 /usr/sbin/apach root 3267 0.0 0.0 8076 1300 ? Ss 08:51 0:00 /usr/sbin/cupsd root 3352 0.0 0.0 0 0 ? S 09:00 0:00 [kworker/u8:1] whisher 3373 4.1 10.7 1272216 442952 ? Sl 09:02 6:02 /opt/sublime_te whisher 3381 2.0 0.2 71952 10144 ? Sl 09:02 2:54 /opt/sublime_te whisher 3428 0.0 0.3 241160 14948 ? Rl 09:02 0:05 mate-terminal whisher 3434 0.0 0.0 2416 528 ? S 09:03 0:00 gnome-pty-helpe whisher 3435 0.0 0.0 7680 1816 pts/2 Ss+ 09:03 0:00 bash whisher 3581 0.0 0.4 285100 17916 ? Sl 09:03 0:07 pluma whisher 3590 7.6 11.4 1396892 475068 ? Sl 09:03 11:04 firefox whisher 3690 0.0 0.0 5304 464 ? S 09:04 0:00 bash /usr/bin/b whisher 3695 2.4 1.1 454944 48184 ? Sl 09:04 3:28 banshee /usr/li whisher 3716 3.0 3.2 1032368 135016 ? Sl 09:05 4:16 /opt/google/chr whisher 3723 0.0 0.0 4248 268 ? S 09:05 0:00 cat whisher 3724 0.0 0.0 4248 240 ? S 09:05 0:00 cat whisher 3727 0.0 0.0 187356 4080 ? S 09:05 0:00 /opt/google/chr whisher 3730 0.0 0.0 19940 644 ? S 09:05 0:00 /opt/google/chr whisher 3733 0.0 0.0 195552 2556 ? S 09:05 0:00 /opt/google/chr whisher 3749 1.3 4.2 532872 177324 ? Sl 09:05 1:55 /opt/google/chr whisher 3753 0.0 0.1 193616 7656 ? S 09:05 0:00 /opt/google/chr whisher 3775 0.0 0.2 301896 12056 ? Sl 09:05 0:00 /opt/google/chr whisher 3785 0.0 0.4 325756 16892 ? Sl 09:05 0:00 /opt/google/chr whisher 3789 1.2 1.1 345472 47968 ? Sl 09:05 1:43 /opt/google/chr whisher 3800 0.0 0.4 312140 18652 ? Sl 09:05 0:05 /opt/google/chr whisher 3806 0.0 0.3 313164 13420 ? Sl 09:05 0:00 /opt/google/chr whisher 3810 0.0 0.2 305992 11840 ? Sl 09:05 0:00 /opt/google/chr whisher 3815 0.0 0.2 301896 11872 ? Sl 09:05 0:00 /opt/google/chr whisher 3820 0.0 0.5 340356 24732 ? Sl 09:05 0:08 /opt/google/chr whisher 3825 0.0 0.3 319312 15440 ? Sl 09:05 0:00 /opt/google/chr whisher 3830 0.0 0.3 310388 15592 ? Sl 09:05 0:00 /opt/google/chr whisher 3835 0.0 0.2 301896 12004 ? Sl 09:05 0:00 /opt/google/chr whisher 3839 0.0 0.2 302920 12188 ? Sl 09:05 0:00 /opt/google/chr whisher 3844 0.3 0.8 347264 35004 ? Sl 09:05 0:28 /opt/google/chr whisher 3855 0.0 0.5 326484 21236 ? Sl 09:05 0:01 /opt/google/chr whisher 3932 2.4 4.4 604956 185624 ? Sl 09:05 3:24 /opt/google/chr whisher 3958 0.2 1.3 376624 57492 ? Sl 09:05 0:23 /opt/google/chr whisher 3985 0.0 0.5 353612 22076 ? Sl 09:05 0:00 /opt/google/chr whisher 4026 0.0 1.0 360116 43920 ? Sl 09:06 0:04 /opt/google/chr whisher 4038 0.2 0.5 294912 21868 ? Sl 09:06 0:20 /opt/google/chr whisher 4078 0.0 0.7 361620 31960 ? Sl 09:06 0:03 /opt/google/chr whisher 4094 0.1 1.1 383820 45740 ? Sl 09:06 0:10 /opt/google/chr whisher 4107 0.0 0.6 368656 25160 ? Sl 09:06 0:01 /opt/google/chr whisher 4134 0.3 1.3 407492 57884 ? Sl 09:06 0:30 /opt/google/chr whisher 4148 0.0 0.4 327784 19192 ? Sl 09:06 0:00 /opt/google/chr whisher 4163 0.0 0.4 333880 19648 ? Sl 09:06 0:00 /opt/google/chr whisher 4175 0.0 0.4 361872 19336 ? Sl 09:06 0:01 /opt/google/chr whisher 4185 0.0 0.8 367848 35256 ? Sl 09:06 0:02 /opt/google/chr whisher 4210 0.0 1.5 431152 63724 ? Sl 09:06 0:02 /opt/google/chr whisher 4219 0.0 0.5 349880 24732 ? Sl 09:06 0:01 /opt/google/chr whisher 4257 0.0 0.9 359436 37700 ? Sl 09:06 0:02 /opt/google/chr www-data 4275 0.0 0.0 109568 1236 ? S 09:06 0:00 /usr/sbin/apach whisher 4284 0.0 1.0 351812 43796 ? Sl 09:06 0:03 /opt/google/chr whisher 4298 0.3 1.7 437344 73880 ? Sl 09:06 0:31 /opt/google/chr whisher 4310 2.5 8.1 700704 338820 ? Sl 09:06 3:37 /opt/google/chr www-data 4341 0.0 0.0 109568 1268 ? S 09:07 0:00 /usr/sbin/apach www-data 4352 0.0 0.0 109568 1276 ? S 09:07 0:00 /usr/sbin/apach whisher 4840 0.3 2.4 504672 101528 ? Sl 09:27 0:26 /opt/google/chr whisher 4866 0.2 2.1 481120 88156 ? Sl 09:27 0:15 /opt/google/chr whisher 4979 1.0 1.5 314700 64532 ? Sl 09:32 1:15 /opt/firefox34. root 5161 0.0 0.0 0 0 ? S 09:44 0:02 [kworker/1:2] whisher 5250 0.4 2.5 434000 104372 ? Sl 09:51 0:25 /opt/google/chr whisher 5337 0.0 0.0 7680 3712 pts/3 Ss 09:56 0:00 bash whisher 7176 12.5 0.8 272356 34924 ? Sl 10:04 10:25 mate-system-mon whisher 7231 0.0 0.0 7680 3108 pts/4 Ss 10:07 0:00 bash root 7450 0.0 0.0 0 0 ? S 10:12 0:00 [kworker/u8:3] whisher 7724 0.4 2.5 414028 106076 ? Sl 10:23 0:18 /opt/google/chr whisher 7768 0.0 2.0 404508 83556 ? Sl 10:24 0:03 /opt/google/chr root 7891 0.0 0.0 0 0 ? S 10:34 0:01 [kworker/3:2] root 7991 0.0 0.0 0 0 ? S 10:39 0:00 [kworker/u8:2] root 8140 0.0 0.0 0 0 ? S< 10:49 0:00 [kworker/u9:2] whisher 8445 0.0 0.7 81216 31236 pts/4 Sl+ 11:01 0:00 node server1.js root 8458 0.0 0.0 0 0 ? S< 11:01 0:00 [kworker/u9:0] root 8519 0.0 0.0 0 0 ? S 11:11 0:00 [kworker/u8:4] whisher 8676 0.1 0.4 71588 16560 pts/3 Sl+ 11:23 0:00 node client2.js whisher 8689 0.0 0.1 7680 4144 pts/9 Ss 11:23 0:00 bash root 8826 0.0 0.0 0 0 ? S< 11:23 0:00 [kworker/u9:1] root 8847 0.0 0.0 0 0 ? S 11:25 0:00 [kworker/u8:0] whisher 8868 2.2 1.5 359644 63212 ? Sl 11:25 0:02 /opt/google/chr whisher 8915 0.0 0.0 5224 1180 pts/9 R+ 11:27 0:00 ps -aux

— Reply to this email directly or view it on GitHub https://github.com/mcollina/mosca/issues/275#issuecomment-111806020.

whisher commented 9 years ago

client2

var mqtt = require('mqtt')

client = mqtt.createClient(1884, 'localhost');

client.subscribe('presence');

client.on('message', function(topic, message) {
    client.publish('presence', 'Client 1 is alive.. Test Ping! ' + Date());

  console.log(message);
});

console.log('Client started...');

server1

var mosca = require('mosca');
/*
var ascoltatore = {
  type: 'redis',
  redis: require('redis'),
  db: 12,
  port: 6379,
  return_buffers: true, // to handle binary payloads
  host: "localhost"
};

var moscaSettings = {
  port: 1884,
  backend: ascoltatore,
  persistence: {
    factory: mosca.persistence.Redis
  }
};

*/
var ascoltatore = {
  //using ascoltatore
  type: 'mongo',
  url: 'mongodb://localhost:27017/mqtt',
  pubsubCollection: 'ascoltatori',
  mongo: {}
};

var moscaSettings = {
  port: 1884,
  backend: ascoltatore
};

//here we start mosca
var server = new mosca.Server(moscaSettings);
server.on('ready', setup);

// fired when the mqtt server is ready
function setup() {
  console.log('Mosca server is up and running')
}

// fired whena  client is connected
server.on('clientConnected', function(client) {
  console.log('client connected', client.id);
});

// fired when a message is received
server.on('published', function(packet, client) {
  console.log('Published : ', packet.payload);
});

// fired when a client subscribes to a topic
server.on('subscribed', function(topic, client) {
  console.log('subscribed : ', topic);
});

// fired when a client subscribes to a topic
server.on('unsubscribed', function(topic, client) {
  console.log('unsubscribed : ', topic);
});

// fired when a client is disconnecting
server.on('clientDisconnecting', function(client) {
  console.log('clientDisconnecting : ', client.id);
});

// fired when a client is disconnected
server.on('clientDisconnected', function(client) {
  console.log('clientDisconnected : ', client.id);
});

my new ps print I've cut down just a lot ^^ but I've still got std::bad_alloc

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   4596  1520 ?        Ss   08:45   0:01 /sbin/init
root         2  0.0  0.0      0     0 ?        S    08:45   0:00 [kthreadd]
root         3  0.7  0.0      0     0 ?        S    08:45   1:21 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    08:45   0:03 [rcu_sched]
root         8  0.0  0.0      0     0 ?        S    08:45   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/0]
root        10  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/0]
root        11  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/1]
root        12  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/1]
root        13  0.5  0.0      0     0 ?        S    08:45   1:05 [ksoftirqd/1]
root        14  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/1:0]
root        15  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/1:0H]
root        16  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/2]
root        17  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/2]
root        18  0.4  0.0      0     0 ?        S    08:45   0:46 [ksoftirqd/2]
root        20  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/2:0H]
root        21  0.0  0.0      0     0 ?        S    08:45   0:00 [watchdog/3]
root        22  0.0  0.0      0     0 ?        S    08:45   0:00 [migration/3]
root        23  0.4  0.0      0     0 ?        S    08:45   0:48 [ksoftirqd/3]
root        25  0.0  0.0      0     0 ?        S<   08:45   0:00 [kworker/3:0H]
root        26  0.0  0.0      0     0 ?        S<   08:45   0:00 [khelper]
root        27  0.0  0.0      0     0 ?        S    08:45   0:00 [kdevtmpfs]
root        28  0.0  0.0      0     0 ?        S<   08:45   0:00 [netns]
root        29  0.0  0.0      0     0 ?        S<   08:45   0:00 [writeback]
root        30  0.0  0.0      0     0 ?        S<   08:45   0:00 [kintegrityd]
root        31  0.0  0.0      0     0 ?        S<   08:45   0:00 [bioset]
root        33  0.0  0.0      0     0 ?        S<   08:45   0:00 [kblockd]
root        34  0.0  0.0      0     0 ?        S<   08:45   0:00 [ata_sff]
root        35  0.0  0.0      0     0 ?        S    08:45   0:00 [khubd]
root        36  0.0  0.0      0     0 ?        S<   08:45   0:00 [md]
root        37  0.0  0.0      0     0 ?        S<   08:45   0:00 [devfreq_wq]
root        38  0.0  0.0      0     0 ?        S    08:45   0:04 [kworker/0:1]
root        40  0.0  0.0      0     0 ?        S    08:45   0:04 [kworker/2:1]
root        41  0.0  0.0      0     0 ?        R    08:45   0:00 [kworker/3:1]
root        42  0.0  0.0      0     0 ?        S    08:45   0:00 [khungtaskd]
root        43  0.1  0.0      0     0 ?        S    08:45   0:14 [kswapd0]
root        44  0.0  0.0      0     0 ?        SN   08:45   0:00 [ksmd]
root        45  0.0  0.0      0     0 ?        SN   08:45   0:02 [khugepaged]
root        46  0.0  0.0      0     0 ?        S    08:45   0:00 [fsnotify_mark]
root        47  0.0  0.0      0     0 ?        S    08:45   0:00 [ecryptfs-kthrea]
root        48  0.0  0.0      0     0 ?        S<   08:45   0:00 [crypto]
root        60  0.0  0.0      0     0 ?        S<   08:45   0:00 [kthrotld]
root        63  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_0]
root        64  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_1]
root        66  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_2]
root        67  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_3]
root        89  0.0  0.0      0     0 ?        S<   08:45   0:00 [deferwq]
root        90  0.0  0.0      0     0 ?        S<   08:45   0:00 [charger_manager]
root        91  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/2:2]
root        92  0.0  0.0      0     0 ?        S    08:45   0:00 [kworker/0:2]
root       142  0.0  0.0      0     0 ?        S<   08:45   0:00 [kpsmoused]
root       172  0.0  0.0      0     0 ?        S    08:45   0:00 [scsi_eh_4]
root       173  0.0  0.0      0     0 ?        S    08:45   0:00 [usb-storage]
root       250  0.0  0.0      0     0 ?        S    08:45   0:01 [jbd2/sda2-8]
root       251  0.0  0.0      0     0 ?        S<   08:45   0:00 [ext4-rsv-conver]
root       373  0.0  0.0   3008   588 ?        S    08:45   0:00 upstart-udev-bridge --daemon
root       379  0.0  0.0  12488   676 ?        Ss   08:45   0:00 /lib/systemd/systemd-udevd --daemon
root       482  0.0  0.0      0     0 ?        S<   08:45   0:00 [kvm-irqfd-clean]
root       483  0.0  0.0      0     0 ?        S<   08:45   0:00 [kmpathd]
root       484  0.0  0.0      0     0 ?        S<   08:45   0:00 [kmpath_handlerd]
root       566  0.0  0.0      0     0 ?        S<   08:45   0:00 [hd-audio0]
mosquit+   634  0.0  0.0   2508   460 ?        Ss   08:45   0:00 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
root       651  0.0  0.0   2868   456 ?        S    08:45   0:00 upstart-socket-bridge --daemon
root       782  0.0  0.0  28404  1396 ?        Ss   08:45   0:00 smbd -F
root       822  0.0  0.0   2880   456 ?        S    08:45   0:00 upstart-file-bridge --daemon
syslog     881  0.0  0.0  31368   552 ?        Ssl  08:45   0:00 rsyslogd
message+   914  0.0  0.0   4768  1412 ?        Ss   08:45   0:00 dbus-daemon --system --fork
root       927  0.0  0.0  38380   964 ?        Ssl  08:45   0:00 /usr/sbin/ModemManager
root       941  0.0  0.0   4876   804 ?        Ss   08:45   0:00 /usr/sbin/bluetoothd
root       953  0.0  0.0   4212   756 ?        Ss   08:45   0:00 /lib/systemd/systemd-logind
avahi      963  0.0  0.0   3472   796 ?        S    08:45   0:00 avahi-daemon: running [Ugo.local]
avahi      965  0.0  0.0   3472   120 ?        S    08:45   0:00 avahi-daemon: chroot helper
root       971  0.0  0.0      0     0 ?        S<   08:45   0:00 [krfcommd]
root       984  0.0  0.0  53136  4052 ?        Ssl  08:45   0:00 NetworkManager
root       987  0.0  0.0  28404   956 ?        S    08:45   0:00 smbd -F
root       993  0.0  0.0  36028  1360 ?        Sl   08:45   0:00 /usr/lib/policykit-1/polkitd --no-debug
root      1011  0.0  0.0   5508   416 ?        S    08:45   0:00 /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /run/sendsigs.omit.d/network-manager.dhclient-eth0.pid -lf /var/lib/Net
nobody    1035  0.0  0.0   5548   752 ?        S    08:45   0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/sendsigs.omit.d/network-manager.dnsmasq.pid --l
root      1225  0.0  0.0  17368   836 ?        Ss   08:45   0:00 nmbd -D
root      1412  0.0  0.0   4644   372 tty4     Ss+  08:45   0:00 /sbin/getty -8 38400 tty4
root      1414  0.0  0.0   4644   372 tty5     Ss+  08:45   0:00 /sbin/getty -8 38400 tty5
root      1421  0.0  0.0   4644   372 tty2     Ss+  08:45   0:00 /sbin/getty -8 38400 tty2
root      1422  0.0  0.0   4644   372 tty3     Ss+  08:45   0:00 /sbin/getty -8 38400 tty3
root      1426  0.0  0.0   4644   372 tty6     Ss+  08:45   0:00 /sbin/getty -8 38400 tty6
root      1463  0.0  0.0   2192   332 ?        Ss   08:45   0:00 acpid -c /etc/acpi/events -s /var/run/acpid.socket
root      1464  0.0  0.0   3052   432 ?        Ss   08:45   0:00 cron
root      1467  0.0  0.0   8700   968 ?        Ss   08:45   0:00 /usr/sbin/cups-browsed
mongodb   1488  0.1  0.4 1859072 18760 ?       Ssl  08:45   0:15 /usr/bin/mongod --config /etc/mongod.conf
root      1585  0.0  0.0   3976   492 ?        Ss   08:45   0:00 /usr/sbin/irqbalance
kernoops  1632  0.0  0.0   6384   544 ?        Ss   08:45   0:00 /usr/sbin/kerneloops
root      1643  0.0  0.0  20912  1052 ?        Ss   08:45   0:00 mdm
redis     1651  0.0  0.0  27864  3228 ?        Ssl  08:45   0:02 /usr/bin/redis-server 127.0.0.1:6379       
root      1673  0.0  0.0      0     0 ?        S<   08:45   0:00 [iprt]
mysql     1713  0.0  0.2 320460  8676 ?        Ssl  08:45   0:04 /usr/sbin/mysqld
root      1982  0.0  0.0   4644   372 tty1     Ss+  08:46   0:00 /sbin/getty -8 38400 tty1
root      2035  0.0  0.0  24128  1484 ?        S    08:46   0:00 mdm
root      2102 12.2  2.0 218036 86276 tty7     Ss+  08:46  23:41 /usr/bin/X :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt7
mdm       2164  0.0  0.0   3848   188 ?        S    08:46   0:00 dbus-launch --autolaunch=b1c51b0d895c13c396980c5554806a52 --binary-syntax --close-stderr
mdm       2173  0.0  0.0   4232   480 ?        Ss   08:46   0:00 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
root      2208  0.0  0.0      0     0 ?        S    08:48   0:00 [kauditd]
whisher   2213  0.0  0.0  46116  1272 ?        Sl   08:49   0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
root      2218  0.0  0.0  34864  1296 ?        Sl   08:49   0:00 /usr/sbin/console-kit-daemon --no-daemon
whisher   2289  0.0  0.0  49740  2748 ?        Ssl  08:49   0:00 x-session-manager
whisher   2478  0.0  0.0   4212    24 ?        Ss   08:49   0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/bin/im-launch x-session-manager
whisher   2481  0.0  0.0   3848   200 ?        S    08:49   0:00 /usr/bin/dbus-launch --exit-with-session /usr/bin/im-launch x-session-manager
whisher   2482  0.0  0.0   4760  1344 ?        Ss   08:49   0:00 //bin/dbus-daemon --fork --print-pid 6 --print-address 9 --session
whisher   2555  0.0  0.0  24508  1528 ?        Sl   08:49   0:00 /usr/lib/dconf/dconf-service
whisher   2562  0.0  0.1 159896  4184 ?        Sl   08:49   0:01 /usr/bin/mate-settings-daemon
whisher   2564  0.0  0.2 231272 10052 ?        Sl   08:49   0:04 marco
whisher   2569  0.0  0.1 237176  4780 ?        Sl   08:49   0:00 mate-panel
whisher   2573  0.0  0.0  27752  1456 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfsd
whisher   2578  0.0  0.0   2264   236 ?        S    08:49   0:00 /bin/sh /usr/bin/startcaja
whisher   2582  0.0  0.0  44376   812 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
whisher   2594  0.8  0.0 165948  4080 ?        S<l  08:49   1:36 /usr/bin/pulseaudio --start --log-target=syslog
whisher   2597  0.0  0.3 278700 15496 ?        Sl   08:49   0:03 /usr/bin/python /usr/lib/linuxmint/mintMenu/mintMenu.py
rtkit     2598  0.0  0.0  21360   644 ?        SNl  08:49   0:00 /usr/lib/rtkit/rtkit-daemon
whisher   2601  0.0  0.1 317872  6900 ?        Sl   08:49   0:01 caja -n
whisher   2603  0.1  0.2 229852 11444 ?        Sl   08:49   0:13 /usr/lib/mate-panel/wnck-applet
whisher   2605  0.0  0.1 237888  6888 ?        Sl   08:49   0:00 /usr/lib/mate-panel/clock-applet
whisher   2607  0.0  0.0 212888  3820 ?        Sl   08:49   0:00 /usr/lib/mate-panel/notification-area-applet
whisher   2626  0.0  0.1 275784  5472 ?        Sl   08:49   0:00 mate-volume-control-applet
whisher   2634  0.0  0.1 258528  5024 ?        Sl   08:49   0:00 nm-applet
whisher   2638  0.0  0.1  41496  4644 ?        Sl   08:49   0:00 mate-power-manager
whisher   2642  0.0  0.0  29796  1540 ?        Sl   08:49   0:00 /usr/lib/i386-linux-gnu/polkit-mate-authentication-agent-1
whisher   2644  0.0  0.0  35492  2528 ?        Sl   08:49   0:00 /usr/bin/python /usr/share/system-config-printer/applet.py
whisher   2647  0.0  0.2  83560 11196 ?        Sl   08:49   0:01 mate-screensaver
root      2657  0.0  0.0  37824  1680 ?        Sl   08:49   0:00 /usr/lib/upower/upowerd
whisher   2664  0.0  0.0  47108  1312 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfsd-trash --spawner :1.9 /org/gtk/gvfs/exec_spaw/0
whisher   2710  0.0  0.0  44636  1336 ?        Sl   08:49   0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher
whisher   2714  0.0  0.0   4232   800 ?        S    08:49   0:00 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
whisher   2729  0.0  0.0  17360  1328 ?        Sl   08:49   0:00 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
whisher   2848  0.0  0.0   9728  1472 ?        S    08:49   0:00 /usr/lib/i386-linux-gnu/gconf/gconfd-2
whisher   2878  0.0  0.0  38696  2344 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
root      2882  0.0  0.0  53636  2108 ?        Sl   08:49   0:01 /usr/lib/udisks2/udisksd --no-debug
root      2888  0.0  0.0  25656  1220 ?        Sl   08:49   0:00 /usr/sbin/system-tools-backends
whisher   2893  0.0  0.0  39364  1552 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfs-afc-volume-monitor
whisher   2903  0.0  0.0  28436  1656 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
whisher   2908  0.0  0.0  27192  1432 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfs-mtp-volume-monitor
whisher   2932  0.0  0.0  19104  2184 ?        Sl   08:49   0:00 /usr/lib/gvfs/gvfsd-metadata
root      2938  0.0  0.0  16020  2228 ?        S    08:49   0:00 /usr/bin/perl /usr/share/system-tools-backends-2.0/scripts/SystemToolsBackends.pl -m Platform
whisher   2955  0.0  0.0   9328   516 ?        S    08:49   0:00 /usr/bin/python /usr/bin/mintupdate-launcher
whisher   2958  0.0  0.0   2264   236 ?        S    08:49   0:00 sh -c /usr/lib/linuxmint/mintUpdate/mintUpdate.py
whisher   2959  0.0  0.2 244324 12144 ?        Sl   08:49   0:00 /usr/bin/python2.7 /usr/lib/linuxmint/mintUpdate/mintUpdate.py
root      3267  0.0  0.0   8076  1144 ?        Ss   08:51   0:00 /usr/sbin/cupsd -f
root      3352  0.0  0.0      0     0 ?        S    09:00   0:00 [kworker/u8:1]
whisher   3373  3.8 10.3 1319340 428924 ?      Sl   09:02   6:45 /opt/sublime_text/sublime_text
whisher   3381  1.9  0.2  71952 10100 ?        Sl   09:02   3:23 /opt/sublime_text/plugin_host 3373
whisher   3428  0.0  0.3 241572 15132 ?        Sl   09:02   0:07 mate-terminal
whisher   3434  0.0  0.0   2416   572 ?        S    09:03   0:00 gnome-pty-helper
whisher   3435  0.0  0.0   7680  1804 pts/2    Ss+  09:03   0:00 bash
whisher   3690  0.0  0.0   5304   460 ?        S    09:04   0:00 bash /usr/bin/banshee --redirect-log --play-enqueued
whisher   3695  2.1  1.1 454824 47312 ?        Sl   09:04   3:44 banshee /usr/lib/banshee/Banshee.exe --redirect-log --play-enqueued
root      5161  0.0  0.0      0     0 ?        S    09:44   0:03 [kworker/1:2]
whisher   5337  0.0  0.0   7680  3320 pts/3    Ss+  09:56   0:00 bash
whisher   7231  0.0  0.0   7680  3576 pts/4    Ss   10:07   0:00 bash
root      7991  0.0  0.0      0     0 ?        S    10:39   0:00 [kworker/u8:2]
root      8519  0.0  0.0      0     0 ?        S    11:11   0:00 [kworker/u8:4]
root      8964  0.0  0.0      0     0 ?        S    11:35   0:00 [kworker/3:0]
root      8981  0.0  0.0      0     0 ?        S<   11:36   0:00 [kworker/u9:1]
root      9016  0.0  0.0      0     0 ?        S    11:40   0:00 [kworker/u8:0]
root      9378  0.0  0.0      0     0 ?        S    11:52   0:00 [kworker/u8:3]
root      9493  0.0  0.0      0     0 ?        S<   11:54   0:00 [kworker/u9:0]
root      9532  0.0  0.0      0     0 ?        S    11:56   0:00 [kworker/3:2]
root      9533  0.0  0.0      0     0 ?        S    11:56   0:00 [kworker/0:0]
root      9583  0.0  0.0      0     0 ?        S<   11:59   0:00 [kworker/u9:2]
whisher   9599  0.0  0.0   5224  1176 pts/4    R+   11:59   0:00 ps -aux

BTW I'm looking for good tutorials and guide on the topic.

mcollina commented 9 years ago

And you still can't run the server? Can you please try running the executable (npm i mosca -g; mosca).

I don't exactly know good tutorials on the topic. I never run Linux Mint, and Mosca have no problem running on generic Linux, so something else might be going on.

whisher commented 9 years ago

Yes, I can run mosca. Ok it doesn't matter may be my localhost has something wrong. You can close the issue I reopen it if I find problem in the server dev/prod. Thanks

On 14 June 2015 at 14:59, Matteo Collina notifications@github.com wrote:

And you still can't run the server? Can you please try running the executable (npm i mosca -g; mosca).

I don't exactly know good tutorials on the topic. I never run Linux Mint, and Mosca have no problem running on generic Linux, so something else might be going on.

— Reply to this email directly or view it on GitHub https://github.com/mcollina/mosca/issues/275#issuecomment-111824761.