Javascript acting multitheaded in Firefox












0















Everything relevant on the internet I've read indicates that Javascript is single-threaded (aside from Web Workers, which run in a different global context and shouldn't be able to directly affect the state in the main thread). However, while debugging some code, I noticed that even while I was paused on such-and-such a line, variables kept changing, even when I didn't step over lines of code. Investigating further, I noticed that, again, even while paused in the debugger (and I wasn't touching anything), logs were logged and errors were thrown every second according to a timeout that had been set.



I am using OS: Windows 10 Enterprise, version 1803, OS build 17134.407.
I experienced the issue in Firefox 63.0.1 (64-bit).
When I tried it in Chrome 70.0.3538.102 (Official Build) (64-bit), however, the issue did not occur - pausing in the debugger appeared to pause all computation, as expected.



I can't provide any useful code, because 1. it's company code, and 2. it's a multithreading style problem, which makes it very difficult to narrow down to any given section of code. Things that might be relevant, aside from aforementioned browser differences: it's an AngularJS application, served to the browser from NodeJS. We're using $interval(), timeout(), $http, and Stomp websocket connections.



According to my understanding, this apparently multithreaded behavior should be impossible. How could this happen?










share|improve this question























  • If there is any multiprocessing going on, it is likely the browser's internal operations that are multithreaded for this anomaly and not the JS runtime. So this seems simply like Mozilla's debugger works differently than Chrome's.

    – Randy Casburn
    Nov 24 '18 at 2:24











  • @RandyCasburn Perhaps, depending on what you mean. If the debugger is to be believed, there is more than one thread of execution. I can step through code in one place, all the while code continues to be executed somewhere else. It seems like this would be an actual bug in Firefox's debugger, rather than a simple difference of operation - if invoking the debugger invisibly and significantly breaks one of the fundamental principles of programming in Javascript, that seems like a bug to me.

    – Erhannis
    Nov 24 '18 at 2:44











  • Then report it after you read the third essential quality here: developer.mozilla.org/en-US/docs/Tools/Debugger-API

    – Randy Casburn
    Nov 24 '18 at 2:51
















0















Everything relevant on the internet I've read indicates that Javascript is single-threaded (aside from Web Workers, which run in a different global context and shouldn't be able to directly affect the state in the main thread). However, while debugging some code, I noticed that even while I was paused on such-and-such a line, variables kept changing, even when I didn't step over lines of code. Investigating further, I noticed that, again, even while paused in the debugger (and I wasn't touching anything), logs were logged and errors were thrown every second according to a timeout that had been set.



I am using OS: Windows 10 Enterprise, version 1803, OS build 17134.407.
I experienced the issue in Firefox 63.0.1 (64-bit).
When I tried it in Chrome 70.0.3538.102 (Official Build) (64-bit), however, the issue did not occur - pausing in the debugger appeared to pause all computation, as expected.



I can't provide any useful code, because 1. it's company code, and 2. it's a multithreading style problem, which makes it very difficult to narrow down to any given section of code. Things that might be relevant, aside from aforementioned browser differences: it's an AngularJS application, served to the browser from NodeJS. We're using $interval(), timeout(), $http, and Stomp websocket connections.



According to my understanding, this apparently multithreaded behavior should be impossible. How could this happen?










share|improve this question























  • If there is any multiprocessing going on, it is likely the browser's internal operations that are multithreaded for this anomaly and not the JS runtime. So this seems simply like Mozilla's debugger works differently than Chrome's.

    – Randy Casburn
    Nov 24 '18 at 2:24











  • @RandyCasburn Perhaps, depending on what you mean. If the debugger is to be believed, there is more than one thread of execution. I can step through code in one place, all the while code continues to be executed somewhere else. It seems like this would be an actual bug in Firefox's debugger, rather than a simple difference of operation - if invoking the debugger invisibly and significantly breaks one of the fundamental principles of programming in Javascript, that seems like a bug to me.

    – Erhannis
    Nov 24 '18 at 2:44











  • Then report it after you read the third essential quality here: developer.mozilla.org/en-US/docs/Tools/Debugger-API

    – Randy Casburn
    Nov 24 '18 at 2:51














0












0








0








Everything relevant on the internet I've read indicates that Javascript is single-threaded (aside from Web Workers, which run in a different global context and shouldn't be able to directly affect the state in the main thread). However, while debugging some code, I noticed that even while I was paused on such-and-such a line, variables kept changing, even when I didn't step over lines of code. Investigating further, I noticed that, again, even while paused in the debugger (and I wasn't touching anything), logs were logged and errors were thrown every second according to a timeout that had been set.



I am using OS: Windows 10 Enterprise, version 1803, OS build 17134.407.
I experienced the issue in Firefox 63.0.1 (64-bit).
When I tried it in Chrome 70.0.3538.102 (Official Build) (64-bit), however, the issue did not occur - pausing in the debugger appeared to pause all computation, as expected.



I can't provide any useful code, because 1. it's company code, and 2. it's a multithreading style problem, which makes it very difficult to narrow down to any given section of code. Things that might be relevant, aside from aforementioned browser differences: it's an AngularJS application, served to the browser from NodeJS. We're using $interval(), timeout(), $http, and Stomp websocket connections.



According to my understanding, this apparently multithreaded behavior should be impossible. How could this happen?










share|improve this question














Everything relevant on the internet I've read indicates that Javascript is single-threaded (aside from Web Workers, which run in a different global context and shouldn't be able to directly affect the state in the main thread). However, while debugging some code, I noticed that even while I was paused on such-and-such a line, variables kept changing, even when I didn't step over lines of code. Investigating further, I noticed that, again, even while paused in the debugger (and I wasn't touching anything), logs were logged and errors were thrown every second according to a timeout that had been set.



I am using OS: Windows 10 Enterprise, version 1803, OS build 17134.407.
I experienced the issue in Firefox 63.0.1 (64-bit).
When I tried it in Chrome 70.0.3538.102 (Official Build) (64-bit), however, the issue did not occur - pausing in the debugger appeared to pause all computation, as expected.



I can't provide any useful code, because 1. it's company code, and 2. it's a multithreading style problem, which makes it very difficult to narrow down to any given section of code. Things that might be relevant, aside from aforementioned browser differences: it's an AngularJS application, served to the browser from NodeJS. We're using $interval(), timeout(), $http, and Stomp websocket connections.



According to my understanding, this apparently multithreaded behavior should be impossible. How could this happen?







javascript multithreading google-chrome firefox






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 1:48









ErhannisErhannis

2,54711428




2,54711428













  • If there is any multiprocessing going on, it is likely the browser's internal operations that are multithreaded for this anomaly and not the JS runtime. So this seems simply like Mozilla's debugger works differently than Chrome's.

    – Randy Casburn
    Nov 24 '18 at 2:24











  • @RandyCasburn Perhaps, depending on what you mean. If the debugger is to be believed, there is more than one thread of execution. I can step through code in one place, all the while code continues to be executed somewhere else. It seems like this would be an actual bug in Firefox's debugger, rather than a simple difference of operation - if invoking the debugger invisibly and significantly breaks one of the fundamental principles of programming in Javascript, that seems like a bug to me.

    – Erhannis
    Nov 24 '18 at 2:44











  • Then report it after you read the third essential quality here: developer.mozilla.org/en-US/docs/Tools/Debugger-API

    – Randy Casburn
    Nov 24 '18 at 2:51



















  • If there is any multiprocessing going on, it is likely the browser's internal operations that are multithreaded for this anomaly and not the JS runtime. So this seems simply like Mozilla's debugger works differently than Chrome's.

    – Randy Casburn
    Nov 24 '18 at 2:24











  • @RandyCasburn Perhaps, depending on what you mean. If the debugger is to be believed, there is more than one thread of execution. I can step through code in one place, all the while code continues to be executed somewhere else. It seems like this would be an actual bug in Firefox's debugger, rather than a simple difference of operation - if invoking the debugger invisibly and significantly breaks one of the fundamental principles of programming in Javascript, that seems like a bug to me.

    – Erhannis
    Nov 24 '18 at 2:44











  • Then report it after you read the third essential quality here: developer.mozilla.org/en-US/docs/Tools/Debugger-API

    – Randy Casburn
    Nov 24 '18 at 2:51

















If there is any multiprocessing going on, it is likely the browser's internal operations that are multithreaded for this anomaly and not the JS runtime. So this seems simply like Mozilla's debugger works differently than Chrome's.

– Randy Casburn
Nov 24 '18 at 2:24





If there is any multiprocessing going on, it is likely the browser's internal operations that are multithreaded for this anomaly and not the JS runtime. So this seems simply like Mozilla's debugger works differently than Chrome's.

– Randy Casburn
Nov 24 '18 at 2:24













@RandyCasburn Perhaps, depending on what you mean. If the debugger is to be believed, there is more than one thread of execution. I can step through code in one place, all the while code continues to be executed somewhere else. It seems like this would be an actual bug in Firefox's debugger, rather than a simple difference of operation - if invoking the debugger invisibly and significantly breaks one of the fundamental principles of programming in Javascript, that seems like a bug to me.

– Erhannis
Nov 24 '18 at 2:44





@RandyCasburn Perhaps, depending on what you mean. If the debugger is to be believed, there is more than one thread of execution. I can step through code in one place, all the while code continues to be executed somewhere else. It seems like this would be an actual bug in Firefox's debugger, rather than a simple difference of operation - if invoking the debugger invisibly and significantly breaks one of the fundamental principles of programming in Javascript, that seems like a bug to me.

– Erhannis
Nov 24 '18 at 2:44













Then report it after you read the third essential quality here: developer.mozilla.org/en-US/docs/Tools/Debugger-API

– Randy Casburn
Nov 24 '18 at 2:51





Then report it after you read the third essential quality here: developer.mozilla.org/en-US/docs/Tools/Debugger-API

– Randy Casburn
Nov 24 '18 at 2:51












1 Answer
1






active

oldest

votes


















0














Nodejs in fact is not single threaded. It has basically two parts:




  • Javascript part. Basically Event loop processes (single threaded).

  • C++ part (libuv library), thanks to V8. This part implements a thread pool with multiple thread to compute costly operations. This way we don't block the event loop.


So, maybe you can check all the modules that you are using and check their implementation. Anyone implemented in C++ uses the thread pool on the background.






share|improve this answer
























  • Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

    – Erhannis
    Dec 4 '18 at 5:42











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454511%2fjavascript-acting-multitheaded-in-firefox%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Nodejs in fact is not single threaded. It has basically two parts:




  • Javascript part. Basically Event loop processes (single threaded).

  • C++ part (libuv library), thanks to V8. This part implements a thread pool with multiple thread to compute costly operations. This way we don't block the event loop.


So, maybe you can check all the modules that you are using and check their implementation. Anyone implemented in C++ uses the thread pool on the background.






share|improve this answer
























  • Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

    – Erhannis
    Dec 4 '18 at 5:42
















0














Nodejs in fact is not single threaded. It has basically two parts:




  • Javascript part. Basically Event loop processes (single threaded).

  • C++ part (libuv library), thanks to V8. This part implements a thread pool with multiple thread to compute costly operations. This way we don't block the event loop.


So, maybe you can check all the modules that you are using and check their implementation. Anyone implemented in C++ uses the thread pool on the background.






share|improve this answer
























  • Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

    – Erhannis
    Dec 4 '18 at 5:42














0












0








0







Nodejs in fact is not single threaded. It has basically two parts:




  • Javascript part. Basically Event loop processes (single threaded).

  • C++ part (libuv library), thanks to V8. This part implements a thread pool with multiple thread to compute costly operations. This way we don't block the event loop.


So, maybe you can check all the modules that you are using and check their implementation. Anyone implemented in C++ uses the thread pool on the background.






share|improve this answer













Nodejs in fact is not single threaded. It has basically two parts:




  • Javascript part. Basically Event loop processes (single threaded).

  • C++ part (libuv library), thanks to V8. This part implements a thread pool with multiple thread to compute costly operations. This way we don't block the event loop.


So, maybe you can check all the modules that you are using and check their implementation. Anyone implemented in C++ uses the thread pool on the background.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 2 '18 at 16:31









Dr. CooperDr. Cooper

12




12













  • Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

    – Erhannis
    Dec 4 '18 at 5:42



















  • Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

    – Erhannis
    Dec 4 '18 at 5:42

















Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

– Erhannis
Dec 4 '18 at 5:42





Hmm. Except, it appears multithreaded even on the client-side. Are the C++ libraries executed client-side? I'd be very surprised; that seems like a very dangerous thing to allow a website to execute.

– Erhannis
Dec 4 '18 at 5:42


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454511%2fjavascript-acting-multitheaded-in-firefox%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Fiat S.p.A.

Type 'String' is not a subtype of type 'int' of 'index'