Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Use JSScript, not script objects, in compile/evaluate API.

RESOLVED FIXED in mozilla9

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Igor Bukanov, Assigned: Igor Bukanov)

Tracking

Other Branch
mozilla9
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

v2
94.11 KB, patch
jorendorff
: review+
Details | Diff | Splinter Review
(Assignee)

Description

6 years ago
After the bug 674251 which turns JSScript into JSObject we no longer need a special object that holds a script to ensure GC rooting. We should eliminate those objects.
(Assignee)

Comment 1

6 years ago
It is not that straightforward to remove the script objects. Currently we use them to find the global for the script for compartment and principals management. So I will leave true elimination of script objects to another bug. For this bug my plan is to continue to create the script objects internally but always use JSScript, not its JSObject* holder, in CompileScript/EvaluateScript API.
Summary: Eliminate JSScripts object → Use JSScript, not script objects, in compile/evaluate API.
(Assignee)

Comment 2

6 years ago
Created attachment 557822 [details] [diff] [review]
v1

This is what I have sent to the try server
Assignee: general → igor
(Assignee)

Comment 3

6 years ago
Created attachment 558090 [details] [diff] [review]
v2

v1 has a leak that is a regression from the bug 674251. In that bug I forgot to update the cycle collector to treat JSScript as a potential source of cycles. The changes in this patch that pass JSScript to AddRoot/LockGCThing exposed that.

In most places the patch just replaces JSObject *scriptObj with JSScript *script. But in js shell, where the disassembling implementation currently converts the script object into jsval to reuse some code, a refactoring was necessary.
Attachment #557822 - Attachment is obsolete: true
Attachment #558090 - Flags: review?(jorendorff)
(Assignee)

Updated

6 years ago
Blocks: 684529
Comment on attachment 558090 [details] [diff] [review]
v2

Pretty straightforward. This is great to see. Sorry for the slow review--I'm in San Jose and it has been a busy week here.

>+    if (script->hasFunction) {
>+        JSFunction *fun = script->function();

Does this work on a script that has never been executed? I thought that stuff was lazily populated by the type inference engine. JSScript::function() asserts not just hasFunction but (hasFunction && types).

>+struct DisassembleOptionParser {

Thank you. Very nice. :)
Attachment #558090 - Flags: review?(jorendorff) → review+
(Assignee)

Comment 5

6 years ago
https://bugzilla.mozilla.org/show_bug.cgi?id=678830 - pushed with a fix not to use script->function() in the disassembling shell functions. Instead the patch uses function pointers that are supplied by the caller.
https://hg.mozilla.org/mozilla-central/rev/5a3e49205389
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Depends on: 687857
This patch caused a new intermittent memory leak in mochitest-chrome leaks.  See bug 687857 comment 123 for details.  This leak is the currently #1 cause of test failures, with over 213 failures in the past 28 days on mozilla-inbound alone:
http://brasstacks.mozilla.com/orangefactor/?display=&tree=mozilla-inbound

Can we back out this patch?  (Are there other patches that have landed since that depend on it?)  Who can investigate the leak?
(Assignee)

Comment 8

6 years ago
(In reply to Matt Brubeck (:mbrubeck) from comment #7)
> Can we back out this patch?

So far no patches that depends on this has landed, so we should be able to back this out.
(In reply to Igor Bukanov from comment #8)
> So far no patches that depends on this has landed, so we should be able to
> back this out.

Would you like me to back this out, Igor, or would you prefer to do it yourself?
(Assignee)

Comment 10

6 years ago
I can do the back out, but can we wait with it until Tuesday?
(In reply to Igor Bukanov from comment #10)
> I can do the back out, but can we wait with it until Tuesday?

Sure.

This patch is on Aurora too; should we request approval to back it out there? (I have no idea whether the test failures indicate a real bug in this patch or if it's just exposing an existing problem elsewhere.)
(Assignee)

Comment 12

6 years ago
(In reply to Matt Brubeck (:mbrubeck) from comment #11)
>(I have no idea whether the test failures indicate a real bug in this
> patch or if it's just exposing an existing problem elsewhere.)

I suspect that with the patch there are more chances that the native stack scanner for the conservative GC finds a JSScript instance that otherwise should be dead leading to the leak.
(Assignee)

Comment 13

6 years ago
It is not simple to back out the patch as after its landing we have landed the refactoring patches that caused a lot of conflicts. I will try too investigate this more. If nothing would come out until FRiday, then I will create a back out patch and ask for its review.
In case it helps with leak hunting, we also saw a definite increase in bug 653080 (a leak in mochitest-browser-chrome) when this landed:
http://brasstacks.mozilla.com/orangefactor/?display=Bug&bugid=653080&startday=2011-09-07&endday=2011-10-05&tree=mozilla-inbound
Depends on: 653080
(Assignee)

Comment 15

6 years ago
(In reply to Matt Brubeck (:mbrubeck) from comment #14)
> In case it helps with leak hunting, we also saw a definite increase in bug
> 653080 (a leak in mochitest-browser-chrome) when this landed:
> http://brasstacks.mozilla.com/orangefactor/
> ?display=Bug&bugid=653080&startday=2011-09-07&endday=2011-10-05&tree=mozilla-
> inbound

Hm, the current spike in oranges is significantly smaller than the one that was observed in August and that ended at the beginning of September. Do we have any explanation for that? For me it looks that currently we ended up currently in the state that existed before the beginning of August.
(In reply to Igor Bukanov from comment #15)
> Hm, the current spike in oranges is significantly smaller than the one that
> was observed in August and that ended at the beginning of September. Do we
> have any explanation for that? For me it looks that currently we ended up
> currently in the state that existed before the beginning of August.

No, I haven't seen any investigation or explanation of the August spike in bug 653080.

Note that the current spike in bug 687857 is just as severe as the August spike in 653080:
http://brasstacks.mozilla.com/orangefactor/?display=Bug&bugid=687857&startday=2011-07-01&endday=2011-10-05&tree=mozilla-inbound
(Assignee)

Comment 17

6 years ago
(In reply to Matt Brubeck (:mbrubeck) from comment #16)
> (In reply to Igor Bukanov from comment #15)
> > Hm, the current spike in oranges is significantly smaller than the one that
> > was observed in August and that ended at the beginning of September. Do we
> > have any explanation for that? For me it looks that currently we ended up
> > currently in the state that existed before the beginning of August.
> 
> No, I haven't seen any investigation or explanation of the August spike in
> bug 653080.

So at worst this bug returned the situation to one that we had in August and we have no information regarding what started that and what stopped that, right? Can we get some correlations for that spike?
(Assignee)

Updated

6 years ago
Blocks: 692914
(Assignee)

Comment 18

6 years ago
I do not think it is productive to back out this bug. Rather I would prefer to spend time developing tools for better leak reporting for JS GC heap, see bug 692914 and then go back to investigate the intermittent leaks. I will work on that bug when I come back from a vacation,
(In reply to Igor Bukanov (offline 2011-10-08 -- 2011-10-15) from comment #18)
> I do not think it is productive to back out this bug.

It seems unusual to me that we would leave a patch in the tree that does not pass our automated tests - especially when it is the top cause of intermittent failures.  If someone had thought to retrigger tests sooner, we would have just backed this out without asking.  (If nothing else, this makes much more work for people watching the tree, because it occurs about a hundred times a week and TBPL does not automatically mark memory leak bugs.)

(In reply to Igor Bukanov (offline 2011-10-08 -- 2011-10-15) from comment #18)
> Rather I would prefer to spend time developing tools for better leak reporting
> for JS GC heap, see bug 692914 and then go back to investigate the intermittent
> leaks.

It's not clear to me from reading bug 692914: Will that resolve the intermittent leaks?  Or will it make them easier to resolve?  Or will it fix poor reporting that made the intermittent leaks go undetected before this patch landed?

Basically, I want to know the plan and estimated schedule for resolving bug 687857, and the rationale for leaving it in the tree in the meantime.  If someone else who understands this code can answer while Igor is on vacation, I'd appreciate it.
Bug 687857 seems to have stopped completely as of 8 October.  I have no idea why - maybe because Igor went on vacation!  :)  If I have time to run hundreds of Try jobs again soon, maybe I will try bisecting to find exactly when it disappeared.

Anyway, if the leaks don't come back then we can consider them fixed and we no longer need to back out this patch.
(Assignee)

Comment 21

6 years ago
(In reply to Matt Brubeck (:mbrubeck) from comment #19)
> (In reply to Igor Bukanov (offline 2011-10-08 -- 2011-10-15) from comment
> #18)
> > I do not think it is productive to back out this bug.
> 
> It seems unusual to me that we would leave a patch in the tree that does not
> pass our automated tests - especially when it is the top cause of
> intermittent failures.  If someone had thought to retrigger tests sooner, we
> would have just backed this out without asking.

I should have write more clear: the amount of work to backout the patch appeared to be substantial as other patches touched the same code. Given that the spike correlated with this bug is not worse then the one from August that appeared and disappeared for unknown reasons my assumption was that some efforts with leak reporting would give a chance at least to understand the reason for the spike and potentially fix the bug.


> It's not clear to me from reading bug 692914: Will that resolve the
> intermittent leaks?  Or will it make them easier to resolve?  Or will it fix
> poor reporting that made the intermittent leaks go undetected before this
> patch landed?

Currently we do not report leaks in the JS runtime at all. The garbage collector just assume on shutdown that everything is the garbage and forcefully release the memory. So we have no idea if the intermittent failures are related to anything in the JS world. And this is what I want to know. But I do not know if the answer would help with fixing the leak.
Depends on: 699796
You need to log in before you can comment on or make changes to this bug.