SVG path getTotalLength hangs for some path with two cubic bezier segments

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
4 years ago
2 years ago

People

(Reporter: Hiroaki Nakamura, Unassigned)

Tracking

({hang, perf})

34 Branch
x86
Mac OS X
hang, perf
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36

Steps to reproduce:

I tried to calculate the path lengths using getTotalLength() for three paths:

    <path id="path1" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" stroke="black" fill="none"/>
    <path id="path2" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/>
    <path id="path3" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" stroke="black" fill="none"/>

You can try this example at http://bl.ocks.org/hnakamur/bc26a6fa7d7b8d9dc795


Actual results:

Firefox hangs for calculating totalPathLength() for '#path3'.

Also, Firefox prints wrong lengths for '#path1' and '#path2'.
path1.length 0 (Bug 950549)
path2.length 123295481856 (Bug 984796)
You can try this example at http://bl.ocks.org/hnakamur/f203e1cb6adedb56eca8

I reproduced this bug with Firefox 31.0 and Firefox Nightly 34.0a1 (2014-07-25) on OS X 10.8.5


Expected results:

Firefox should not hang. Firefox should print the correct results of getTotalLength() to the console.
Component: Untriaged → SVG
Product: Firefox → Core
Trunk doesn't hang for me on Windows, it just prints the numbers I expect. Could be mac only of course.
(In reply to Robert Longson from comment #1)
> Trunk doesn't hang for me on Windows, it just prints the numbers I expect.
> Could be mac only of course.
Couldn't also reproduce on OS X 10.9.4, 34.0a1 (2014-08-04).
Please check if the issue occurs using Firefox in safe mode (with your addons disabled):
http://support.mozilla.com/kb/Safe+Mode

And on a new, empty profile:
http://support.mozilla.org/en-US/kb/Managing-profiles#w_starting-the-profile-manager
Flags: needinfo?(hnakamur)
(Reporter)

Comment 3

4 years ago
In Safe Mode, Firefox 31.0, OS X 10.8.5

Values of path1 and path2 are wrong again, however Firefox does not hang this time. Here is log output.

"path1" <path fill="none" stroke="black" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" id="path1"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path1.length" 0 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
"path2" <path fill="none" stroke="black" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" id="path2"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path2.length" 123295481856 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create


With a new empty profile, Firefox 31.0, OS X 10.8.5

"path1" <path fill="none" stroke="black" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" id="path1"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path1.length" 0 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
"path2" <path fill="none" stroke="black" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" id="path2"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path2.length" 123295481856 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create


Now I noticed one thing unusual. I installed Firefox with homebrew cask, so Firefox is installed at ~/Application/Firefox instead of /Application/Firefox.

I downloaded Firefox from https://www.mozilla.org/ja/firefox/new/, installed it to /Application/Firefx and tried again.


Normal mode, Firefox 31.0, OS X 10.8.5
"path1" <path fill="none" stroke="black" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" id="path1"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path1.length" 0 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
"path2" <path fill="none" stroke="black" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" id="path2"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path2.length" 123295481856 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

Safe mode, Firefox 31.0, OS X 10.8.5
"path1" <path fill="none" stroke="black" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" id="path1"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path1.length" 0 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
"path2" <path fill="none" stroke="black" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" id="path2"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path2.length" 123295481856 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create


Emtpy profile, Firefox 31.0, OS X 10.8.5
"path1" <path fill="none" stroke="black" d="M229.99999999999994,196.66666666666666C229.99999999999997,213.33333333333331,229.99999999999997,246.66666666666666,241.66666666666663,263.3333333333333" id="path1"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path1.length" 0 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
"path2" <path fill="none" stroke="black" d="M241.66666666666663,263.3333333333333C253.33333333333331,280,276.66666666666663,280,288.3333333333333,280" id="path2"> b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:35
"path2.length" 123295481856 b68f3765748ddb6ad4f8dd7027ed7b15ac57694b:36
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

I found the following logs are printed on the terminal.
Aug  5 22:09:48 nakamura-mac.local firefox-bin[25557] <Error>: clip: empty path.
Aug  5 22:09:48 nakamura-mac.local firefox-bin[25557] <Error>: clip: empty path.
Flags: needinfo?(hnakamur)
(Reporter)

Comment 4

4 years ago
I tried tests on another machine, MacBook Pro 2012, OS X 10.9.4


Normal mode, Homebrew Firefox 31.0
-> hangs

Safe mode, Homebrew Firefox 31.0
-> hangs

Empty profile, Homebrew Firefox 31.0
-> hangs



Normal mode, Firefox 31.0 from https://www.mozilla.org/ja/firefox/new/
-> hangs

Safe mode, Firefox 31.0 from https://www.mozilla.org/ja/firefox/new/
-> hangs

Empty profile, Firefox 31.0 from https://www.mozilla.org/ja/firefox/new/
-> hangs

On this machine, Firefox hangs in all 6 patterns.
Hangs for me in Nightly with a new profile, on MacOSX 10.8.5.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 6

4 years ago
Hangs for me either... The same happens for getPointAtLength().
Mac OS X 10.9.4
Firefox 32.0.1
Comment hidden (spam)
Likely the same issue as bug 1066556.
See Also: → bug 1066556
Comment hidden (spam)
@infos26: Please don't add comments like comment 7 and comment 9. This bug is already known to affect Firefox 31 and newer.

Hopefully someone on the graphics and/or SVG teams can take a look at this soon; in the meantime, weekly "bug still exists" comments aren't helpful, and just end up cluttering up the bug-page and making it harder to follow.

Updated

4 years ago
Keywords: hang, perf

Comment 11

2 years ago
No longer applies to me in Ubuntu 15.10 with FF 45.0.1. The values produces by the example in comment 0 seem correct now (values very close to Chrome and Safari, no hanging).
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Depends on: 1134549
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.