question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

There is an issue with .pause/.resume

See original GitHub issue

I heavily rely on pause-resume methods. I use chunk-streaming processing and here is what I’ve found: https://github.com/mholt/PapaParse/blob/master/papaparse.js#L403

else if (isFunction(this._config.chunk))
{
    this._config.chunk(results, this._handle);
    if (this._paused)
        return;
    results = undefined;
}

this._paused is always false in this context. It has to be checked by this._handle.paused()

Another part of the issue is in the resume implementation, but let’s look at pause method at first:

this.pause = function()
{
    _paused = true;
    _parser.abort();
    _input = _input.substr(_parser.getCharIndex());
};

_input will be always an empty string (!) if we use chunk-streaming. On resume, PapaParse will parse the empty string again and will fire callbacks with empty results.

My JavaScript code is not that good, which is why I’m creating this issue instead of a pull request, but here is my attempt to patch the issue:

@@ -367,6 +367,12 @@

                 this.parseChunk = function(chunk)
                 {
+                        if (chunk.length === 0) {
+                                // It is possible due to the pause/resume implementation.
+                                this._nextChunk();
+                                return;
+                        }
+
                         // Rejoin the line we likely just split in two by chunking the file
                         var aggregate = this._partialLine + chunk;
                         this._partialLine = "";
@@ -400,7 +406,7 @@
                         else if (isFunction(this._config.chunk))
                         {
                                 this._config.chunk(results, this._handle);
-                                if (this._paused)
+                                if (this._handle.paused())
                                         return;
                                 results = undefined;
                         }

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
gabegorelickcommented, Apr 9, 2018

After more testing, it appears the issues with step are not exactly the same as with chunk. Changing my above code to use chunk makes it work after the fix from #479 is applied. But step still doesn’t work.

2reactions
thiagonuiccommented, Feb 23, 2018

@mrksbnch I have the same problem, busy with projects… I’ll see if I find some time and I’ll keep this topic updated if I find something

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix Printer Status is Paused, Cannot Resume error in ...
If your Printer Status is Paused and Cannot Resume, you need to disable 'Pause Printing'. Here are some more fixes to resolve the...
Read more >
Fix Printer Status is Paused, Cannot Resume error ... - YouTube
Some Windows users are reporting that when their printer pauses and stops printing. Therefore, in this article, we will be talking about ...
Read more >
How to Pause and Resume sync in OneDrive - Microsoft Support
To Resume syncing · Tap the paused OneDrive icon in the notification/menu area: · In the activity center, select More again and select...
Read more >
Pause and resume is dead - CardEasy
It's only one part of a complicated set of PCI DSS compliance requirements · It doesn't sit well with your customer service or...
Read more >
Distribution Pause / Resume Page - IBM
If the pause record is in this status and the date and time in last updated column is not actively updating, there might...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found