Inkscape freezes in open dialog if a large file is previewed

Bug #167869 reported by Raduc-users
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Expired
High
Unassigned

Bug Description

When previewing a large file in the open dialog,
Inkscape freezes, though opening the same file from the
command line (when no preview is involved) takes only a
couple seconds.

To reproduce:

- download www.xfig.org/zhb/homebrew.fig
- open homebrew.fig in Inkscape and save as Inkscape SVG
- open homebrew.svg (or .svgz) from the File->Open
dialog by selecting it in the list (for preview).
- Inkscape locks (CPU utilizaiton goes to 100%)

This seems to be related to the way file preview is
done, from the command line the same file can be opened
without problems.

Tags: linux ui
Revision history for this message
Bryce Harrington (bryce) wrote :

Originator: NO

File Added: homebrew.fig

Revision history for this message
Peter Lewerin (vermeil-deactivatedaccount) wrote :

I think this needs further verification regarding generality, etc, and also if it still exists.

Changed in inkscape:
status: New → Incomplete
Revision history for this message
Tom Davidson (tjd-mit) wrote :

I can't open .fig files in my version of inkscape (maybe I don't have the required converter). Can you attach the svg file that actually causes the problem?
Better still, can you first test whether this still occurs with one of the 0.46 preview releases?
Thanks!

Revision history for this message
pbaggio (pierangelo-baggio) wrote :

i have verified the same problem...
but i've noticed that's this occurs also -in my case- when the svg is very simple, but inside it has references to external images.
the -eventually- attached images (jpg, tif, ...) inside of the svg, seems (obviosly) be directly involved to the time of drawing preview.
the only way i've found to solve it is... simply turn off preview when i'm working with this files...
for the developers: i suggest (if it isn't yet implemented) the following possible solutions:
(1) -for the preview- the "scanner" of attached-images must try to look if the attached images have preview-image inside of them
(2) if the attached images are exceding a defined size limit (for example, 2Mb), put a dummy-image... (for example, "preview too big")...
(3) the preview drawing program must not freeze the inkscape running process

Revision history for this message
joelholdsworth (joel-airwebreathe) wrote :

This is difficult to solve, because the inkscape renderer is currently not threadsafe, and so cannot be run in a worker thread. Maybe as we move over to cairo this will become less difficult, but for now AFAIK there's no way of interrupting rendering once it's underway!

Revision history for this message
ishmal (ishmalius) wrote :

hi, all!

pbaggio's #2 suggestion is precisely what was coded into the Gtkmm preview. If the file is larger than a certain size (I think we used 1MB), then display an inlined svg file that says "Too large for preview". You could likely be able to just copy and paste the code for that. If this problem is with the Gtkmm dialog, then maybe the threshold needs to be lower.

Revision history for this message
MenTaLguY (mental-deactivatedaccount) wrote :

Please don't copy and paste code. Factor it out into shared functions/classes which can be used in both the new and original places.

Bertrand Petit (bp-lp)
Changed in inkscape:
status: Incomplete → Confirmed
Revision history for this message
Tomasz Sztejka (sztejkat) wrote :

I can confirm that behaviour with any large file which takes significant amount of time to load in Inkscape.

The user side solution to that problem WOULD be simple: disable preview. The catch is, it doesn't work - it seems that preview loading code is running REGARDLESS if preview box is checked or not. Effectively it prevents You from opening large file since any click on it's name causes "hang" when hidden preview is generated. Sad but true.

Inkscape 0.48.3.1 r9886 running Linux.

There are three possible solutions:

 -first, fix an obvious mistake and not only hide preview when "preview" check-box is unchecked but also DO NOT run preview generation code.

 -second, which will help solving huge lags when working with large objects and large blurs - make renderer interruptible. That is, for an example, after rendering each single object/section/whatever You do have there, monitor if "abort rendering" singnal is set. This signal might be set for an example by user pressing ESC key. This should be doable even if renderer isn't thread safe. I don't know GTK details, but it might be possible to poll for ESC from another thread and set a signal for a renderer in a tiny well controlled thread safe place. Since this is a boolean signal which can be set once and only once each pass there is really no need for synchronisation code. The same functionality may be used to timeout a renderer, which, in my opinion, would be a very nice feauture. I do have to, from time to time, to go for a coffee (up to 2 minutes or so) until a blurred image is rendered. And have no way to interrupt it.

 -third, if preview functionality is essential, generate a tiny bitmap at save and embedd it as a comment or some hidden element in an "Inkscape SVG" file. Thous generating preview might be simple, fast and accurate enough.

Anyway, great tool. But slow as a hell in a very surprising places. Shame there is so very little comments in source - it's too time consuming to get involved in fixing it.

Revision history for this message
su_v (suv-lp) wrote :

> The user side solution to that problem WOULD be simple: disable preview. The catch is,
> it doesn't work - it seems that preview loading code is running REGARDLESS if preview
> box is checked or not.

This has been fixed in current trunk and will work in the next stable release (0.49) as expected, see
Bug #826027 “Preview calculated anyway in Open File dialog”
<https://bugs.launchpad.net/inkscape/+bug/826027>

Revision history for this message
Martin Owens (doctormo) wrote :

Investigating this bug is very difficult without an example file. The fig file linked doesn't work with any of my inkscape versions and testing requires an svg file. I'm marking as Incomplete until STR and attached files are sufficient for testing.

Changed in inkscape:
status: Confirmed → Incomplete
Revision history for this message
Bart Van Audenhove (bart-vanaudenhove) wrote :

I think there are two separate problems here:
1) filesize
2) complexity of SVG-file (more or less independently of filesize).

To demonstrate this, take a new document, make a rectangle, create tiled clones (5x5) with shifting colors. Group these, then create tiled clones (50x50) of this group (simple translation). In document properties, resize the document to the entire drawing (maybe important for preview). Save it.
Close document, then do File > Open. Activate preview and click on the filename. In my case (i7, 16Gb memory), the file is about 500 kB and it takes more than 20 seconds for the preview to appear. If it were only a question of filesize, it would open in a jiffy (I open >50Mb files in Gimp in seconds).

In one SVG I made, filesize is < 200kB and preview takes forever due to complexity of clones (I think).

Revision history for this message
LittleBigBrain (braingateway) wrote :

not possible to open the original file at all:

fig2dev failed:

Incorrect format at line 4459

Revision history for this message
Sylvain Chiron (frigory) wrote :

> not possible to open the original file at all:

I have the same problem with `convert` from ImageMagick.
You just have to open the file and remove the two empty lines at the end to make it valid.
However, in my case, it just generates a raster image and Inkscape doesn't have any problem to open it.

Revision history for this message
Sylvain Chiron (frigory) wrote :

bart-vanaudenhove > To demonstrate this

You mean, something like this? It causes no problem on my computer, a simple ‘intel inside’ laptop with 4 GB of RAM.

Revision history for this message
Name (username12345654321) wrote :

The file dessin.svg (Tried to realize the described image) causes inkscape to hang for about 30 seconds on my pc.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Inkscape because there has been no activity for 60 days.]

Changed in inkscape:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.