Git Product home page Git Product logo

Comments (9)

ForbesLindesay avatar ForbesLindesay commented on May 23, 2024

Yes, I would love to see long stack traces implemented. We can use Q as a good example of a library that already implements them. We should make them disabled by default and allow people to require('promise/lib/long-stack-traces') if they want them enabled.

from promise.

amasad avatar amasad commented on May 23, 2024

Can you help me understand this stacktrace:

 ERROR  Cannot read property 'length' of null
TypeError: Cannot read property 'length' of null
    at Promise._94 (react-native-github/node_modules/promise/lib/core.js:138:31)
    at Promise._82 (react-native-github/node_modules/promise/lib/core.js:129:8)
    at react-native-github/node_modules/promise/lib/core.js:97:24
    at flush (react-native-github/node_modules/promise/node_modules/asap/raw.js:50:29)
    at process._tickCallback (node.js:415:13)

from promise.

amasad avatar amasad commented on May 23, 2024

Apparently it's a race. After tracing back this call stack to the original source it seems that asap is calling twice (and finalizing) on the same promise. If I change a part of my code from Promise.all to a serial chain this works fine.

from promise.

ForbesLindesay avatar ForbesLindesay commented on May 23, 2024

Interesting. Can you share the code to reproduce this? It sounds like this might be related to #93 but I was never able to get code to reproduce that.

from promise.

amasad avatar amasad commented on May 23, 2024

let me try and boil it down to something reproducible.
Another random thought, could this be an issue with interop with a different promise library like bluebird?

from promise.

ForbesLindesay avatar ForbesLindesay commented on May 23, 2024

It's definitely possible. Either way I really want to get to the bottom of it. If there's a bug in asap or this lib then finding it would be a huge win.

from promise.

ForbesLindesay avatar ForbesLindesay commented on May 23, 2024

I've reconstructed as much as I can of what the original stack trace should look like. Unfortunately it doesn't tell me much extra:

TypeError: Cannot read property 'length' of null
    at Promise._finale (react-native-github/node_modules/promise/lib/core.js:138:31)
    at Promise._resolve (react-native-github/node_modules/promise/lib/core.js:129:8)
    at react-native-github/node_modules/promise/lib/core.js:97:24
    at flush (react-native-github/node_modules/promise/node_modules/asap/raw.js:50:29)
    at process._tickCallback (node.js:415:13)
From previous event:
    at Promise._handle (react-native-github/node_modules/promise/lib/core.js:87)

from promise.

amasad avatar amasad commented on May 23, 2024

I couldn't reproduce outside of the codebase. I'm going to have to add you to my (internal) diff and you only have to change from bluebird to promise to start reproing

from promise.

ForbesLindesay avatar ForbesLindesay commented on May 23, 2024

It turns out this is (as you suspected) caused by asap sometimes calling back twice and sometimes not at all. The offending issue is kriskowal/asap#55, which has now been resolved. Updating asap should be sufficient, which should happen automatically if you delete any caches and re-install.

I will release an update of promise that requires the latest version of asap though to encourage people to update faster.

from promise.

Related Issues (20)

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.