GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — timer: call list.start regardless new or not by abbr · Pull Request #2830 · nodejs/node

Conversation

@abbr

@abbr abbr commented Sep 12, 2015

Copy link
Copy Markdown

Call start regardless whether list is new
or not to prevent incorrect active_handles
count.

Fixes issue nodejs/node-v0.x-archive#25831.
Ported from pr nodejs/node-v0.x-archive#25832 and #2788.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Gjum reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@brendanashworth brendanashworth added the timers Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout(). label Sep 12, 2015
@Fishrock123 Fishrock123 self-assigned this Sep 13, 2015
@kjhangiani

kjhangiani commented Sep 14, 2015

Copy link
Copy Markdown

+1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1 similar comment
@sterling

sterling commented Sep 25, 2015

Copy link
Copy Markdown

+1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Sep 26, 2015

Copy link
Copy Markdown
Contributor

Note: I'm on vacation and won't have time to look at this for a while.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sterling

sterling commented Sep 26, 2015

Copy link
Copy Markdown

Is there anyone who could look at it in your absence?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Sep 26, 2015

Copy link
Copy Markdown
Contributor

Cc @misterdjules / @bnoordhuis

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sterling

sterling commented Oct 12, 2015

Copy link
Copy Markdown

@Fishrock123 This fix is pretty critical for me and my org. Will you be available soon to take a look at this? Thanks ahead of time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Oct 12, 2015

Copy link
Copy Markdown
Contributor

@sterlinghw are you experiencing this due to running https://github.com/abbr/deasync, or somehow else?

Are you using uv_run in some c++ addon?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fishrock123
Fishrock123 reviewed Oct 12, 2015
View reviewed changes
Comment thread test/parallel/test-timers-active-handles.js Outdated

@Fishrock123 Fishrock123 Oct 12, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should follow how tests/addons are compiled/run, as this here is very brittle.

(And it needs to go into tests/addons)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@trevnorris trevnorris Oct 12, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow up: running make test-addons will automatically build your addon if placed in the correct location. instructions on this are listed in my previous comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sterling

sterling commented Oct 12, 2015

Copy link
Copy Markdown

We are using deasync

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

trevnorris
trevnorris reviewed Oct 12, 2015
View reviewed changes
Comment thread test/parallel/test-timers-active-handles/deasync.cc Outdated

@trevnorris trevnorris Oct 12, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong place for this test. All these files would go in test/addon/<test-name>/. If you are going to include any module then the node_module folder needs to be checked in with the test. Though we generally don't allow third party dependencies in our tests, more so in native tests. Because native APIs break faster than module authors can keep up. And we aren't in the habit of floating patches on top of other libraries.

IMO this test will need to be written stand alone.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Fishrock123 Fishrock123 Oct 12, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trevnorris The test here merely has the name of the module, there are no module deps.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@trevnorris trevnorris Oct 12, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Fishrock123

Fishrock123 commented Oct 12, 2015

Copy link
Copy Markdown
Contributor

@sterlinghw After further investigation, it doesn't seem like this fix works on windows at this point.

deasync relies very heavily on node's internals, and you shouldn't consider it supported by us. That is liable to break at any time. I suggest using the async workflow node was built to use.

If you really need async things to look sync, maybe take a look at co or generator-runner?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sterling

sterling commented Oct 12, 2015

Copy link
Copy Markdown

@Fishrock123 Thanks for looking into this.

As for alternatives, it's not really about making async things look sync. For our use case, it's about trying to avoid a massive refactor of our code base and deasync is the closest thing we can find that will solve the issue. There is a particular function in our code that is heavily used and integral to our application. It is currently a synchronous function, but due to new requirements, it needs to become async. This is a huge problem for us because changing it to async causes a cascade of refactors, which will ultimately cause nearly all of our sync functions to become async. For our large code base, we want to avoid this at all costs if possible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

trevnorris
trevnorris reviewed Oct 12, 2015
View reviewed changes
Comment thread test/parallel/test-timers-active-handles/deasync.cc Outdated

@trevnorris trevnorris Oct 12, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isolate* isolate = args.GetIsolate();

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kjhangiani

kjhangiani commented Oct 12, 2015

Copy link
Copy Markdown

@Fishrock123 We are in the same situation as @sterlinghw. Have already explored coroutines, generators, yield/async, various other methods, but deasync ultimately is the only library that accomplishes what we need to accomplish. Otherwise, we end up with a major refactor of pretty much every portion of our backend. Deasync is by far the cleanest way for us to satisfy our requirements, and while it depends on the internals, it's also extremely simple, and does not block node elsewhere.

We are also eagerly awaiting this fix.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trevnorris

trevnorris commented Oct 12, 2015

Copy link
Copy Markdown
Contributor

This PR needs to be rebased on latest master. It's very out of date.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@whitingj

whitingj commented Oct 12, 2015

Copy link
Copy Markdown

@Fishrock123 what is the problem on Windows? Any idea of what needs to be fixed?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@abbr
timer: call list.start regardless new or not
966b336
Call start regardless whether list is new
or not to prevent incorrect active_handles
count.

Fixes nodejs/node-v0.x-archive#25831
@abbr
abbr force-pushed the fix-issue-timer-master branch from 6e6d304 to 966b336 Compare October 13, 2015 01:43
@abbr

abbr commented Oct 13, 2015

Copy link
Copy Markdown
Author

@trevnorris @Fishrock123 , moved test files to addons and rebased to latest master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@abbr abbr mentioned this pull request Oct 13, 2015
deasync hangs in an asynchronous context abbr/deasync#21
Open
@vkurchatkin

vkurchatkin commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

As @Fishrock123 said, deasync approach is not supported. If this is a really a bug with timers, tests should contain only public API, i. e. setTimeout, clearTimeout, etc.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/487/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123 Fishrock123 mentioned this pull request Oct 13, 2015
Test addons on windows test-ci #3339
Closed
@Fishrock123

Fishrock123 commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

@Fishrock123 what is the problem on Windows? Any idea of what needs to be fixed?

I'm pretty sure @trevnorris said that this patch errored on windows, but it is possible he was referring to something else.

Also, it turns out the CI doesn't test these on windows.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trevnorris

trevnorris commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

That comment on IRC was in regards to whether a change in this PR would fix a different issue I was facing. Sadly, it didn't.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

trevnorris
trevnorris reviewed Oct 13, 2015
View reviewed changes
Comment thread test/addons/timers-active-handles/binding.cc Outdated

@trevnorris trevnorris Oct 13, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead we prefer using v8::Local etc. for everything this test will use.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@trevnorris

trevnorris commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

Oop. I just realized you're running the event loop within the same event loop. Yeah, that's definitely not supported by libuv. Sorry.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

Is anyone able to tell me when the parent issue originated? I.e. what version?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@abbr

abbr commented Oct 13, 2015

Copy link
Copy Markdown
Author

First reported in v0.12. See top of PR. But could happen long before.

On Oct 13, 2015, at 10:44 AM, Jeremiah Senkpiel [email protected] wrote:

Is anyone able to tell me when the parent issue originated? I.e. what version?

—
Reply to this email directly or view it on GitHub.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@whitingj

whitingj commented Oct 23, 2015

Copy link
Copy Markdown

@trevnorris @Fishrock123 @vkurchatkin, you guys are right that this is an unusual use case. However in the initial issue (nodejs/node-v0.x-archive#25831) filed against node js 0.12 it appears that there is a legitimate bug with how the code is handling the active handles and callback. misterdjules appears to agree this is a real bug nodejs/node-v0.x-archive#25831 (comment).

Even though the standard setTimeout and clearTimeout don't expose this problem it would be great to get this fixed. What are the chances we get this fix in?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trevnorris

trevnorris commented Oct 23, 2015

Copy link
Copy Markdown
Contributor

Link to related discussion: #2795 (comment)

I believe part of this relies on implementation details in libuv, and platform differences on how closed timer handles are handled.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott
Trott force-pushed the master branch from 1e896a6 to 082cc8d Compare December 27, 2015 02:00
@kjhangiani

kjhangiani commented Mar 11, 2016

Copy link
Copy Markdown

Any update on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vkurchatkin

vkurchatkin commented Mar 11, 2016

Copy link
Copy Markdown
Contributor

I'm going to close this for now, since no way to reproduce a bug using timers API was provided. We can only assume that there is no bug, just a peculiarity of timers' internals.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vkurchatkin vkurchatkin closed this Mar 11, 2016
@dy

dy commented Apr 8, 2016

Copy link
Copy Markdown

@vkurchatkin I am not into the details of the PR, but the bug, caused the issue related with this PR still exists and quite acute. I’ve tested it over with deasync in glslify-sync in the latest [email protected] and it is here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vkurchatkin

vkurchatkin commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

@dfcreative it doesn't seems to be a bug in node

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dy

dy commented Apr 8, 2016

Copy link
Copy Markdown

@vkurchatkin maybe it is not, it was just marked as a bug for 0.12 and 4.x, 5.x reproduce it. Anyways it is preventing a bunch of really useful packages to work as they could.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mermaid

mermaid commented Apr 8, 2016

Copy link
Copy Markdown

I also agree with @dfcreative. It's definitely a bug to me. Maybe it's a bug that can only exposed using native extensions, but its still a bug thats causing problems for me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Apr 8, 2016

Copy link
Copy Markdown
Member

Reopening so this can be investigated further.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell reopened this Apr 8, 2016
@vkurchatkin

vkurchatkin commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

There is no way to reproduce it using public APIs, so it's not bug. What deasync does is not supported

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Apr 8, 2016

Copy link
Copy Markdown
Member

I get that, I just want to look into this a bit to see if there's something else that can be done here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Fishrock123

Fishrock123 commented Apr 8, 2016

Copy link
Copy Markdown
Contributor

I have unmarked it as a bug in the old repo. Perhaps this is solvable, but using deasync is quite literally UNSAFE.

NotYoojun reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fishrock123
Fishrock123 reviewed Apr 8, 2016
View reviewed changes
Comment thread lib/timers.js
}
// Call start regardless whether list is new
// or not to prevent incorrect active_handles
// count. See https://github.com/nodejs/node-v0.x-archive/issues/25831.

@Fishrock123 Fishrock123 Apr 8, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new logic is definitely not correct.

If you do this you are at very high risk (almost 100%) of delaying existing, running timers. Read my extensive comments in

node/lib/timers.js

Lines 68 to 78 in 7c9a691

// With this, virtually constant-time insertion (append), removal, and timeout
// is possible in the JavaScript layer. Any one list of timers is able to be
// sorted by just appending to it because all timers within share the same
// duration. Therefore, any timer added later will always have been scheduled to
// timeout later, thus only needing to be appended.
// Removal from an object-property linked list is also virtually constant-time
// as can be seen in the lib/internal/linkedlist.js implementation.
// Timeouts only need to process any timers due to currently timeout, which will
// always be at the beginning of the list for reasons stated above. Any timers
// after the first one encountered that does not yet need to timeout will also
// always be due to timeout at a later time.
on how this works if you don't believe me.

Perhaps it would work correctly if you did the following:

list.start(Timer.now() - list._idlePrev._idleStart, 0);

If that worked, I would be willing to entertain changing the impl to that.

(Note: made comment on a different line so it would show at the bottom of the issue thread.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell jasnell added the wip Issues and PRs that are still a work in progress. label Apr 8, 2016
@jasnell

jasnell commented Apr 8, 2016

Copy link
Copy Markdown
Member

Oh yeah, I'm definitely not advocating this particular proposed approach... just that I would like to investigate the kind of alternatives you're suggesting. It likely will turn out exactly as @vkurchatkin suggests (that we simply close again without further action) but I'd like to at least explore a bit more :-)

NotYoojun reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Apr 19, 2016

Copy link
Copy Markdown
Member

Spent some time going through this over this weekend and pretty much reached the same conclusion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell closed this Apr 19, 2016
@dead-claudia dead-claudia mentioned this pull request Oct 26, 2016
Lint multiple files in parallel [$500] eslint/eslint#3565
Closed
@mcjc29 mcjc29 mentioned this pull request Jul 26, 2018
On updating to version 2 tests are not running - possible issue with deasync pact-foundation/karma-pact#15
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Fishrock123 Fishrock123

Labels

timers Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout(). wip Issues and PRs that are still a work in progress.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

11 participants

@abbr @kjhangiani @sterling @Fishrock123 @trevnorris @whitingj @vkurchatkin @dy @mermaid @jasnell @brendanashworth
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.