Bug 360 - pulseview crashes when vcd file used
Summary: pulseview crashes when vcd file used
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Input: vcd (show other bugs)
Version: unreleased development snapshot
Hardware: All Linux
: Normal normal
Target Milestone: ---
Assignee: Nobody
Depends on:
Reported: 2014-05-30 21:18 CEST by geo
Modified: 2023-04-07 21:58 CEST (History)
6 users (show)

vcd file that can be used to replicate the problem (136.53 KB, application/octet-stream)
2014-05-30 21:24 CEST, geo

Note You need to log in before you can comment on or make changes to this bug.
Description geo 2014-05-30 21:18:01 CEST
Pulseview crashes when a particular vcd file is used.

On a 64bit system with 4G ram it tries to use all the memory available until gets killed by the kernel.
please see attached the vcd file that can be use to replicate the problem.

Even if this vcd file is converted from a csv file it does not seem to produce any problem with gtkwave.

please note that this file is not an "original" vcd file, it's created using a convertor from a csv file containing an usb capture.

some fields might not be 100% inline with vcd specification but even so this should not generate a crash.

Comment 1 geo 2014-05-30 21:24:39 CEST
Created attachment 76 [details]
vcd file that can be used to replicate the problem
Comment 2 Wolfram Sang 2016-01-09 02:29:15 CET
So, your VCD file spans over 3.8 seconds with 1ns resolution for 2 channels. As Uwe explained to me recently, sigrok currently needs memory for all the samples, not only the few where a state changes. This is planned to be changed somewhen. Until then, the workaround is to use a less fine-grained resolution. (Changing component to libsigrok which is where the decoding happens.)
Comment 3 Soeren Apel 2016-02-02 21:43:13 CET
From a UX perspective, the least PV can do here is not crash and show a meaningful error message instead. As the malloc() probably happens in libsigrok, PV can't catch this, however. Needs looking into how to handle this on a libsigrok level.
Comment 4 Gerhard Sittig 2017-03-23 18:56:39 CET
When the VCD file was created and the timebase cannot get adjusted in 
hindsight, there is the "downsample" option of the sigrok VCD input module, 
to work around such high resolution long duration input streams.  The 
"compress" option can shorted extended periods of time with idle signals.  

$ sigrok-cli -I vcd --show
Comment 5 Gerhard Sittig 2018-02-04 13:40:08 CET
Workarounds are available.  Have loaded the file here successfully with 
either of the two approaches:  Adjust the timescale to 10ns (as the 
generator software probably should have done, the data seems to not have 
been sampled at a rate of 1GHz), or stick with 1ns scale and specify 
-I vcd:downsample=10 upon invocation.

Adding support for sparse changes in combination with high sample rates 
is a long term goal of the project, and independent from the specific VCD 
input format.

I'd suggest to close that report here (file loads, data decodes fine, 
workarounds available, reporter inactivity, etc).
Comment 6 Uwe Hermann 2018-04-20 18:29:24 CEST
Confirmed. File imports fine with a downsampling factor of 10 and the USB decoders also successfully decode the data.

Closing this bug for now, no VCD issue per se. The "PulseView runs out of RAM" issue is tracked at bug #975 independently, and in the future we'll optimize all of this some more anyway by not requiring to keep all samples around in expanded form.
Comment 7 james an 2023-04-07 21:58:41 CEST
Another group of people who use hookah hoses are those who enjoy aromatherapy. Hookahs can be used to diffuse essential oils, and the hookah hose is used to inhale the scented vapor. https://hosesguide.com/best-4-way-hose-splitter/