Inkscape freezes in open dialog if a large file is previewed

Bug #167869 reported by Raduc-users on 2006-07-31
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
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.

Bryce Harrington (bryce) wrote :

Originator: NO

File Added: homebrew.fig

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

Changed in inkscape:
status: New → Incomplete
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!

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

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!

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.

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) on 2008-09-29
Changed in inkscape:
status: Incomplete → Confirmed
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.

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>

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

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).

LittleBigBrain (braingateway) wrote :

not possible to open the original file at all:

fig2dev failed:

Incorrect format at line 4459

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.

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.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers