Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Feature Idea: Node-fibers, memory leaks, conflated transactions


#1

I’d love to hear if others are using New Relic with node-fibers (successfully or unsuccessfully), and/or if someone can explain how we might patch node-fibers to resolve these issues:

We believe we’re seeing memory leaks and conflated transactions because of our use of laverdet/node-fibers. Our hunch is the issue relates to newrelic’s use of node-continuation-local-storage, but thus far don’t understand the /why/. We were, however, able to construct a minimal test case that demonstrates our issue.

Take the following gist:

After an npm install (node v0.10.26, FWIW), run the provided test.sh script. Here’s my output:

$ sh test.sh
express server listening at http://0.0.0.0:3000/
GET /one c24054cd939c
GET /two c24054cd939c

You can see the two requests share the same transaction.

As I said, we’ve yet to understand why this happens, but we have found two workarounds so far that seem to fix the issue (read: give each request its own transaction):

Workaround 1: require express before newrelic

If we swap lines 3 and 4 in server.js, here’s what we see:

$ sh test.sh
express server listening at http://0.0.0.0:3000/
GET /two 7da09ad31d08dc
GET /one 1068e6dab0c3f10

Workaround 2: trade express.use for express.all '/*'

If we comment line 20 and uncomment line 21, we also see the correct behavior:

$ sh test.sh
express server listening at http://0.0.0.0:3000/
GET /one 140709fe4382050
GET /two 1d8cf17561bf99

TIA,
–Bob


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.


#2

Hi @bobzoller, right now getting the agent to work as expected with node-fibers is a feature request. We’ve followed up with you in the ticket we opened, and have given this suggestion to our product team.


#3

Thanks Alexis. I’ll update this thread if we find a solution.


#4

Hello @alexis, any updates on this? I was just evaluating NewRelic for our Meteor application and ran into issue with Fibers as outlined here.

It looks like I can go through our app and patch all the areas where Meteor is complaining, but that doesn’t fill me with confidence that we won’t end up with other problems once deployed to production.

[ERROR] Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
     at Object.Meteor._nodeCodeMustBeInFiber (packages/meteor.js:1075:11)
     at Object.Meteor.bindEnvironment (packages/meteor.js:1151:10)
     at MongoConnection.<anonymous> (packages/meteor.js:211:27)
     at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:774:49)
     at [object Object].update (packages/mongo/collection.js:589:29)

#5

Thanks for letting us know about your patches, @ratiofu. I will also pass your input along to our product team. Please be sure to add your vote to the poll as well! :blush:


#6

Hello Lindsay, do you have any updates on this? We’d really love to use New Relic …


#7

We would love that, too @ratiofu! Unfortunately there is no news to share on this right now. Please add your vote and your use case so our product team knows how many people will benefit from having this. Thanks so much!