Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'row' of undefined #14

Open
teckays opened this issue Dec 10, 2016 · 8 comments
Open

TypeError: Cannot read property 'row' of undefined #14

teckays opened this issue Dec 10, 2016 · 8 comments

Comments

@teckays
Copy link

teckays commented Dec 10, 2016

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.

@jkeen
Copy link

jkeen commented Apr 10, 2017

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

@peterdolan
Copy link

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

@jkeen
Copy link

jkeen commented May 29, 2017

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.

@acidjazz
Copy link

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

@slavafomin
Copy link

slavafomin commented Sep 7, 2017

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)

@filmaj
Copy link

filmaj commented Nov 24, 2017

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

@shusak
Copy link

shusak commented Dec 19, 2017

I also see this running on my Jenkins platform.

@axelrindle
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants