Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Random unit testing fail on mosca.persistence.LevelUp #160

Closed
mocheng opened this issue Jun 25, 2014 · 12 comments
Closed

Random unit testing fail on mosca.persistence.LevelUp #160

mocheng opened this issue Jun 25, 2014 · 12 comments

Comments

@mocheng
Copy link
Contributor

mocheng commented Jun 25, 2014

I cannot stably reproduce it. On v0.21.8, from time to time the unit testing fails with below message.

  1. mosca.persistence.LevelUp multiple offline packets should store and stream multiple offline packet:
    Error: timeout of 2000ms exceeded
    at null. (/Users/chengmo/github/mosca/node_modules/mocha/lib/runnable.js:139:19)
    at Timer.listOnTimeout as ontimeout
@mcollina
Copy link
Collaborator

This happened on 0.21.7. I think I fixed it in 0.21.8 (eg I could not
reproduce it anymore). Can you please check if you have the latest thing?
Also an npm install might help.

Il mercoledì 25 giugno 2014, Morgan Cheng notifications@github.com ha
scritto:

I cannot stably reproduce it. On v0.21.8, from time to time the unit
testing fails with below message.

  1. mosca.persistence.LevelUp multiple offline packets should store and
    stream multiple offline packet:
    Error: timeout of 2000ms exceeded
    at null.
    (/Users/chengmo/github/mosca/node_modules/mocha/lib/runnable.js:139:19)
    at Timer.listOnTimeout as ontimeout


Reply to this email directly or view it on GitHub
#160.

@mocheng
Copy link
Contributor Author

mocheng commented Jun 26, 2014

The bug still exists on 0.21.8 with clean clone and npm install.

@mcollina
Copy link
Collaborator

Confirmed, a patch on master is coming. My fault :(.

@mcollina
Copy link
Collaborator

Pushed. Can you please check on latest master?

@mocheng
Copy link
Contributor Author

mocheng commented Jun 27, 2014

I've merge the comment f9f4cca , but the UT still fails randomly, with different behaviour.

Before the fix, it just fails and test case ends. Now, when I run below command:

./node_modules/.bin/mocha -R list test/persistence/levelup_spec.js

It may fails with below error, but it never ends. I mean, it just hangs there without returning to console. I have to Ctrl-C to stop it.

․ mosca.persistence.LevelUp retained messages should store retain messages: 1ms
․ mosca.persistence.LevelUp retained messages should lookup retain messages and not matching: 1ms
․ mosca.persistence.LevelUp retained messages should match and load a retained message: 3ms
․ mosca.persistence.LevelUp retained messages should match and load a single retained message: 2ms
․ mosca.persistence.LevelUp retained messages should overwrite a retained message: 2ms
․ mosca.persistence.LevelUp retained messages should remove a retained message if the payload is empty: 2ms
․ mosca.persistence.LevelUp retained messages should match and load with a 'some' pattern: 2ms
․ mosca.persistence.LevelUp retained messages should match and load with a 'one' pattern: 1ms
․ mosca.persistence.LevelUp retained messages should wire itself up to storePacket method of a Server: 1ms
․ mosca.persistence.LevelUp retained messages should wire itself up to the forwardRetained method of a Server: 1ms
․ mosca.persistence.LevelUp subscriptions should store the an offline client subscriptions: 2ms
․ mosca.persistence.LevelUp subscriptions should load the offline client subscriptions: 2ms
․ mosca.persistence.LevelUp subscriptions should store and load the an offline client subscriptions: 1ms
․ mosca.persistence.LevelUp subscriptions should not store the subscriptions of clean client: 1ms
․ mosca.persistence.LevelUp subscriptions should not remove the subscriptions after lookup: 1ms
․ mosca.persistence.LevelUp subscriptions should allow a clean client to connect: 1ms
․ mosca.persistence.LevelUp subscriptions should load an empty subscriptions object for a clean client: 2ms
․ mosca.persistence.LevelUp subscriptions should clean up the subscription store if a clean client connects: 1ms
․ mosca.persistence.LevelUp subscriptions should wire itself up to the restoreClientSubscriptions method of a Server: 3ms
․ mosca.persistence.LevelUp subscriptions should wire itself up to the persistClient method of a Server: 1ms
․ mosca.persistence.LevelUp subscriptions should clean up the subscription store after a TTL: 753ms
․ mosca.persistence.LevelUp subscriptions should not store a QoS 0 subscription: 0ms
․ mosca.persistence.LevelUp offline packets should store an offline packet: 2ms
․ mosca.persistence.LevelUp offline packets should not stream any offline packet: 0ms
․ mosca.persistence.LevelUp offline packets should store and stream an offline packet: 0ms
․ mosca.persistence.LevelUp offline packets should support multiple subscription command: 1ms
․ mosca.persistence.LevelUp offline packets should delete the offline packets once streamed: 1ms
․ mosca.persistence.LevelUp offline packets should delete an offline packet if said so: 1ms
․ mosca.persistence.LevelUp offline packets should update the id of an offline packet: 2ms
․ mosca.persistence.LevelUp offline packets should clean up the offline packets store if a clean client connects: 2ms
․ mosca.persistence.LevelUp offline packets should not store any offline packet for a clean client: 1ms
․ mosca.persistence.LevelUp offline packets should store an offline packet for a client after lookup: 1ms
․ mosca.persistence.LevelUp offline packets should not stream any offline packet to a clean client: 1ms
․ mosca.persistence.LevelUp offline packets should wire itself up to the storePacket method of a Server: 1ms
․ mosca.persistence.LevelUp offline packets should wire itself up to the forwardOfflinePackets method of a Server: 1ms

  1. mosca.persistence.LevelUp multiple offline packets should store and stream multiple offline packet
    ․ mosca.persistence.LevelUp offline packets pattern should store and stream an offline packet: 2ms
    ․ mosca.persistence.LevelUp inflight packets should store one inflight packet: 1ms
    ․ mosca.persistence.LevelUp inflight packets should store and stream an inflight packet: 1ms
    ․ mosca.persistence.LevelUp inflight packets should not delete the offline packets once streamed: 1ms
    ․ mosca.persistence.LevelUp inflight packets should wire itself up to the persistClient method of a Server: 1ms
    ․ mosca.persistence.LevelUp two instances support restoring from disk: 7ms

41 passing (1s)
1 failing

@mocheng
Copy link
Contributor Author

mocheng commented Jun 27, 2014

image

Hope a snapshot of failing ut helps. It actually fails on testcase mosca.persistence.LevelUp multiple offline packets should store and stream multiple offline packet.

This can be easily reproduced if I run the UT right after another UT running. I'm not familiar with LevelUp, but it seems "LevelUp" can disfunction if it is "HOT". Just my guess.

@mcollina mcollina reopened this Jun 27, 2014
@mcollina
Copy link
Collaborator

What operating system are you on, what version of node.js? The latest commit solves the original issue, so this must be something else.

@mocheng
Copy link
Contributor Author

mocheng commented Jun 27, 2014

chengmo@~$sw_vers
ProductName:    Mac OS X
ProductVersion: 10.9.3
BuildVersion:   13D65
chengmo@~$node -v
v0.10.28

Mac OS 10.9.3 and node v0.10.28

Recently, seems some traivs build fails on this testcase as wel.

@mcollina
Copy link
Collaborator

That's harder than I thought. As I'm using random to generate a disambiguation id for the message, causing the fact that we may have messages delivered not in order.
The 'stop the world' thing you are seeing is mocha trying to calculate the diff between two 16KB buffers.

Skip that test, I'll work on it.

@mcollina
Copy link
Collaborator

I've pushed some stuff, have a look.

@mocheng
Copy link
Contributor Author

mocheng commented Jun 27, 2014

Fetched. I ran the unit test case for 100 times and there is no error again.

Good Job! 👍

@mcollina
Copy link
Collaborator

👯

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