ascii-progress icon indicating copy to clipboard operation
ascii-progress copied to clipboard

TypeError: Cannot read property 'row' of undefined

Open teckays opened this issue 7 years ago • 8 comments

TypeError: Cannot read property 'row' of undefined
    at WriteStream.<anonymous> (/Users/.../node_modules/node-progress-bars/index.js:34:14)

This error is thrown when I have multiple iterations that exceeds the number of opened files allowed, EMFILE on mac.

reproduce:

const Progress = require('node-progress-bars')

const iterations = 15000
const prg = new Progress()
prg.total = iterations

for (let i = 0; i <= iterations; i++) {
  prg.tick()
}

result:

node test.js
 [▇▇▇▇▇▇—————————————————————————] 8783/15000 59% 11.9s 20.3s

for me it stops at around 8800

The error is not thrown in this example, for me it is thrown when I use it inside a Promise chain.

teckays avatar Dec 10 '16 11:12 teckays

I'm also getting this error. I'm using it inside a promise chain as well, and it stops between 7425-8200 every time.

jkeen avatar Apr 10 '17 13:04 jkeen

Identical thing happening to me -- stops around 8645. Did either of you two figure out what was going on?

peterdolan avatar May 02 '17 18:05 peterdolan

I started stepping through the code and it looks like it's a problem with get-cursor-position.

ProgressBar.prototype.render = function (output) {
  if (this.output === output) {
    return;
  }

  var current = getCursorPos.sync();
  if (!current) {
    return;
  }
....

When it gets around that critical time (7425ish), getCursorPos.sync() returns nothing, and it looks like that's a native function it's calling.

jkeen avatar May 29 '17 17:05 jkeen

/home/ec2-user/waa/node_modules/ascii-progress/index.js:442 this.cursor.moveTo(this.savePos.row, this.savePos.col); ^

TypeError: Cannot read property 'row' of undefined at ProgressBar.terminate (/home/ec2-user/waa/node_modules/ascii-progress/index.js:442:34) at ProgressBar.snoop (/home/ec2-user/waa/node_modules/ascii-progress/index.js:423:10) at ProgressBar.tick (/home/ec2-user/waa/node_modules/ascii-progress/index.js:162:8) at ProgressBar.update (/home/ec2-user/waa/node_modules/ascii-progress/index.js:170:8) at EventEmitter.uploader.on (/home/ec2-user/waa/operations/aeonian.js:200:11) at emitNone (events.js:86:13) at EventEmitter.emit (events.js:185:7) at EventEmitter. (/home/ec2-user/waa/node_modules/s3/lib/index.js:1168:14) at emitNone (events.js:86:13) at EventEmitter.emit (events.js:185:7)

acidjazz avatar Jun 19 '17 07:06 acidjazz

Hello!

Thank you for this great module!

I do have this problem also right out of the box. I've just copied the example from README:


var ProgressBar = require('ascii-progress');

var bar = new ProgressBar({
  schema: ':bar',
  total : 10
});

var iv = setInterval(function () {
  bar.tick();
  if (bar.completed) {
    clearInterval(iv);
  }
}, 100);
.../node_modules/ascii-progress/index.js:442
  this.cursor.moveTo(this.savePos.row, this.savePos.col);
                                 ^
TypeError: Cannot read property 'row' of undefined
    at ProgressBar.terminate (.../node_modules/ascii-progress/index.js:442:34)
    at ProgressBar.snoop (.../node_modules/ascii-progress/index.js:423:10)
    at ProgressBar.tick (.../node_modules/ascii-progress/index.js:162:8)
    at Timeout._onTimeout (.../src/progress.js:10:7)
    at ontimeout (timers.js:488:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:283:5)

slavafomin avatar Sep 07 '17 14:09 slavafomin

Can confirm I have the same thing happening as @slavafomin, but only on my RedHat Jenkins instance. Running interactively from my Mac yields no problems.

OS info:

$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	RedHatEnterpriseServer
Description:	Red Hat Enterprise Linux Server release 7.4 (Maipo)
Release:	7.4
Codename:	Maipo

filmaj avatar Nov 24 '17 02:11 filmaj

I also see this running on my Jenkins platform.

shusak avatar Dec 19 '17 14:12 shusak

I also get this issue on Raspbian:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.3 (stretch)
Release:	9.3
Codename:	stretch

$ uname -a
Linux pi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux

It's working fine on Ubuntu:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 17.10
Release:	17.10
Codename:	artful

$ uname -a
Linux devpc 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

axelrindle avatar Feb 10 '18 20:02 axelrindle