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

Tweak Mode sometimes freezes while running, require a force quit #3928

Closed
benfry opened this Issue Sep 30, 2015 · 17 comments

Comments

Projects
None yet
@benfry
Member

benfry commented Sep 30, 2015

Seen while running Nature of Code examples, probably a threading deadlock somewhere.

@HenriAugusto

This comment has been minimized.

Show comment
Hide comment
@HenriAugusto

HenriAugusto Oct 1, 2015

It's happening for me too.

I'm really trying to attach a .txt file with the code that crashes, but for some reason i get an error everytime i try. So i'm going to put full code here. Sorry!

int maxPoints = 30;
int index = 0;
float[][] pos = new float[maxPoints][2];
PVector creature;
PVector vel;
float speed = 30;
float borderLeft = 100;
float borderTop = 500;
float borderRight = 100;
float borderBottom = 100;


void setup(){
  size(1200,700);
  creature = new PVector(width/2+100,height/2);
  vel = new PVector(speed,0);
  //vel.rotate(   random(0,TWO_PI)   );
  vel.rotate(PI/4);
  //PVector vertex1 = new PVector(borderLeft,borderTop);
  //PVector vertex2 = new PVector(borderRight,borderTop);
  //PVector vertex3 = new PVector(borderRight,borderBottom);
  //PVector vertex4 = new PVector(borderLeft,borderBottom);
}

void draw(){
  translate(0,height);
  scale(1,-1);
  background(255);
  background(128,0,64);
  strokeWeight(4);
  rect(borderLeft, borderBottom, width-borderRight, height-borderTop );
  ellipse(borderLeft,borderTop,20,20);


  //pos[index][0]=mouseX;
  //pos[index][1]=height-mouseY;
  pos[index][0]=creature.x;
  pos[index][1]=creature.y;
  creature.add(vel);

  if(creature.x<borderLeft || creature.x>width-borderRight){
    vel.add(   new PVector(-2*vel.x,0)   ); 
  }

  if(creature.y<borderBottom || creature.y>height-borderTop){
    vel.add(   new PVector(0,-2*vel.y)   ); 
  }

  if(frameCount<2){
    for(int i=1;i<maxPoints;i++){
    pos[i][0]=mouseX;
    pos[i][1]=height-mouseY;;
    }
  }

  index++;
  index = index % maxPoints;

  for(int i=index+1;i<(index+maxPoints);i++){ //index+1 otherwise it would link the first position to the last

    int currentIndex = i % maxPoints;
    int prevIndex = currentIndex -1 ;
    if(prevIndex<0){prevIndex += maxPoints;}
    float x1 = pos[currentIndex][0]; 
    float y1 = pos[currentIndex][1];
    float x2 = pos[prevIndex][0];
    float y2 = pos[prevIndex][1];
    //ellipse(x1,y1,20,20);

    strokeWeight(10-map(i,index+1,index+maxPoints,10,0)  ); //invert 0 and ten to change head and tails
    stroke(255);
    //stroke(255,   map(i,index+1,index+maxPoints,0,255)    );
    //strokeCap(SQUARE);
;
    line(x1,y1,x2,y2);
  }


  }

HenriAugusto commented Oct 1, 2015

It's happening for me too.

I'm really trying to attach a .txt file with the code that crashes, but for some reason i get an error everytime i try. So i'm going to put full code here. Sorry!

int maxPoints = 30;
int index = 0;
float[][] pos = new float[maxPoints][2];
PVector creature;
PVector vel;
float speed = 30;
float borderLeft = 100;
float borderTop = 500;
float borderRight = 100;
float borderBottom = 100;


void setup(){
  size(1200,700);
  creature = new PVector(width/2+100,height/2);
  vel = new PVector(speed,0);
  //vel.rotate(   random(0,TWO_PI)   );
  vel.rotate(PI/4);
  //PVector vertex1 = new PVector(borderLeft,borderTop);
  //PVector vertex2 = new PVector(borderRight,borderTop);
  //PVector vertex3 = new PVector(borderRight,borderBottom);
  //PVector vertex4 = new PVector(borderLeft,borderBottom);
}

void draw(){
  translate(0,height);
  scale(1,-1);
  background(255);
  background(128,0,64);
  strokeWeight(4);
  rect(borderLeft, borderBottom, width-borderRight, height-borderTop );
  ellipse(borderLeft,borderTop,20,20);


  //pos[index][0]=mouseX;
  //pos[index][1]=height-mouseY;
  pos[index][0]=creature.x;
  pos[index][1]=creature.y;
  creature.add(vel);

  if(creature.x<borderLeft || creature.x>width-borderRight){
    vel.add(   new PVector(-2*vel.x,0)   ); 
  }

  if(creature.y<borderBottom || creature.y>height-borderTop){
    vel.add(   new PVector(0,-2*vel.y)   ); 
  }

  if(frameCount<2){
    for(int i=1;i<maxPoints;i++){
    pos[i][0]=mouseX;
    pos[i][1]=height-mouseY;;
    }
  }

  index++;
  index = index % maxPoints;

  for(int i=index+1;i<(index+maxPoints);i++){ //index+1 otherwise it would link the first position to the last

    int currentIndex = i % maxPoints;
    int prevIndex = currentIndex -1 ;
    if(prevIndex<0){prevIndex += maxPoints;}
    float x1 = pos[currentIndex][0]; 
    float y1 = pos[currentIndex][1];
    float x2 = pos[prevIndex][0];
    float y2 = pos[prevIndex][1];
    //ellipse(x1,y1,20,20);

    strokeWeight(10-map(i,index+1,index+maxPoints,10,0)  ); //invert 0 and ten to change head and tails
    stroke(255);
    //stroke(255,   map(i,index+1,index+maxPoints,0,255)    );
    //strokeCap(SQUARE);
;
    line(x1,y1,x2,y2);
  }


  }

@daimonWolf

This comment has been minimized.

Show comment
Hide comment
@daimonWolf

daimonWolf Oct 1, 2015

When i use "tweak" option all Processing is blocked, I can not interact with JVM and I can not use the API, after some seconds the interface start be black or glitched.
I am using Win 8.1 and the last Java software

daimonWolf commented Oct 1, 2015

When i use "tweak" option all Processing is blocked, I can not interact with JVM and I can not use the API, after some seconds the interface start be black or glitched.
I am using Win 8.1 and the last Java software

@galsasson

This comment has been minimized.

Show comment
Hide comment
@galsasson

galsasson Oct 2, 2015

Contributor

I'll look into this.

Can you please elaborate on when exactly do you get a freeze?
Is it right after you launch it with "Tweak", or after you play with some values, and if so what value was the last one touched.

@HenriAugusto, I could not reproduce with the code that you posted on my machine. What OS are you on? What version of Processing?

Thanks

Contributor

galsasson commented Oct 2, 2015

I'll look into this.

Can you please elaborate on when exactly do you get a freeze?
Is it right after you launch it with "Tweak", or after you play with some values, and if so what value was the last one touched.

@HenriAugusto, I could not reproduce with the code that you posted on my machine. What OS are you on? What version of Processing?

Thanks

@HenriAugusto

This comment has been minimized.

Show comment
Hide comment
@HenriAugusto

HenriAugusto Oct 2, 2015

Im using Processing 3.0 on Windows 7 64 bits

HenriAugusto commented Oct 2, 2015

Im using Processing 3.0 on Windows 7 64 bits

@Talinf

This comment has been minimized.

Show comment
Hide comment
@Talinf

Talinf Oct 2, 2015

Some precision for my case: Processing v3, Windows 8.1
I'm using the example Math:AdditiveWave
When I start the tweak mode on the sketch, the sketch window open normally. At the same moment the editor window do not respond to any mouse action (close, menu actions, stop, etc.(move and resize window work, when using resize, the window content is not refreshed)). The sketch window could be close normally, but to shutdown the editor and the Java examples windows, the task manager must be used.

The version Processing 3 alpha 3.0b5 do not exhibit this behavior on the same machine (i.e. tweak mode is fully operational).

Talinf commented Oct 2, 2015

Some precision for my case: Processing v3, Windows 8.1
I'm using the example Math:AdditiveWave
When I start the tweak mode on the sketch, the sketch window open normally. At the same moment the editor window do not respond to any mouse action (close, menu actions, stop, etc.(move and resize window work, when using resize, the window content is not refreshed)). The sketch window could be close normally, but to shutdown the editor and the Java examples windows, the task manager must be used.

The version Processing 3 alpha 3.0b5 do not exhibit this behavior on the same machine (i.e. tweak mode is fully operational).

@joshgiesbrecht

This comment has been minimized.

Show comment
Hide comment
@joshgiesbrecht

joshgiesbrecht Oct 2, 2015

Contributor

Same thing, Windows 10 64-bit. Happens even on a bare-bones sketch with just a size() call in setup and a background() call in draw.

Contributor

joshgiesbrecht commented Oct 2, 2015

Same thing, Windows 10 64-bit. Happens even on a bare-bones sketch with just a size() call in setup and a background() call in draw.

@joshgiesbrecht

This comment has been minimized.

Show comment
Hide comment
@joshgiesbrecht

joshgiesbrecht Oct 2, 2015

Contributor

Ok, I tried narrowing down which commit this happens on, and someone clued me into 'git bisect' so this might even be sane. But this commit seems really benign:

b343953 is the first bad commit
commit b343953
Author: Jakub Valtar jakub.valtar@gmail.com
Date: Sat Sep 26 10:08:52 2015 -0400

Set selection mode for error table

Maybe it's something close by? I know threading bugs can be unpredictable so this may be off, but it really seemed like either a commit would work for me or it wouldn't, even on a clean rebuild.

Might try this over again later but I'm low on spare time for now.

Also in earlier commits I sometimes see Tweak mode complain that it couldn't create a socket; it continues to run but the controls have no effect on the sketch. Only happened every once and a while, and could just restart tweak mode while the IDE was open and it would work the next time. (Don't know if this is related or not.)

EDIT: Checked again and this doesn't seem right. Saw the bug show up on a slightly earlier commit, and it hasn't been reproducible every time.

Contributor

joshgiesbrecht commented Oct 2, 2015

Ok, I tried narrowing down which commit this happens on, and someone clued me into 'git bisect' so this might even be sane. But this commit seems really benign:

b343953 is the first bad commit
commit b343953
Author: Jakub Valtar jakub.valtar@gmail.com
Date: Sat Sep 26 10:08:52 2015 -0400

Set selection mode for error table

Maybe it's something close by? I know threading bugs can be unpredictable so this may be off, but it really seemed like either a commit would work for me or it wouldn't, even on a clean rebuild.

Might try this over again later but I'm low on spare time for now.

Also in earlier commits I sometimes see Tweak mode complain that it couldn't create a socket; it continues to run but the controls have no effect on the sketch. Only happened every once and a while, and could just restart tweak mode while the IDE was open and it would work the next time. (Don't know if this is related or not.)

EDIT: Checked again and this doesn't seem right. Saw the bug show up on a slightly earlier commit, and it hasn't been reproducible every time.

@galsasson

This comment has been minimized.

Show comment
Hide comment
@galsasson

galsasson Oct 4, 2015

Contributor

Thanks for trying to nail it down.
This seems like a windows thing, could be a Java update?
Anyone with a mac or linux was able to reproduce it?

Unfortunately, I have only a mac available at the moment and unable to reproduce it here.
I will have access to a windows machine only in about a week.

Contributor

galsasson commented Oct 4, 2015

Thanks for trying to nail it down.
This seems like a windows thing, could be a Java update?
Anyone with a mac or linux was able to reproduce it?

Unfortunately, I have only a mac available at the moment and unable to reproduce it here.
I will have access to a windows machine only in about a week.

@multimentha

This comment has been minimized.

Show comment
Hide comment
@multimentha

multimentha Oct 5, 2015

I'm experiencing similar issues with Tweak mode (as described by @Talinf above) on Win 7 x64. I have tried several sketches and was able to find at least one where everything works as intended:

Examples → Basic/Transform/Arm: works as intended
Examples → Basic/Transform/Rotate: bug as described above, must kill java process with task manager

I've tinkered around with the Rotate example a little bit and found out that the culprit lies with the translate function. If you comment that line out, tweak mode works as intended:

// translate(width/2, height/2);

Update: Now I don't know what I have changed, but all of a sudden tweak mode works on all sketches, even those that would previously crash!

multimentha commented Oct 5, 2015

I'm experiencing similar issues with Tweak mode (as described by @Talinf above) on Win 7 x64. I have tried several sketches and was able to find at least one where everything works as intended:

Examples → Basic/Transform/Arm: works as intended
Examples → Basic/Transform/Rotate: bug as described above, must kill java process with task manager

I've tinkered around with the Rotate example a little bit and found out that the culprit lies with the translate function. If you comment that line out, tweak mode works as intended:

// translate(width/2, height/2);

Update: Now I don't know what I have changed, but all of a sudden tweak mode works on all sketches, even those that would previously crash!

@lymanzhang

This comment has been minimized.

Show comment
Hide comment
@lymanzhang

lymanzhang Oct 6, 2015

I also encountered the same problem that when I use "tweak" option, the whole Processing IDE is blocked. The running window can be closed, but the IDE window can just be closed with force quit. I' tried Processing 3.0 on both Windows 8.1 64-bit bits and Windows 10 64-bit with this problem. The test code is quite simple as followed.

void setup(){
  size(600, 600);
}

void draw(){
  background(50);
  ellipse(width/2,height/2,50,50);

}

lymanzhang commented Oct 6, 2015

I also encountered the same problem that when I use "tweak" option, the whole Processing IDE is blocked. The running window can be closed, but the IDE window can just be closed with force quit. I' tried Processing 3.0 on both Windows 8.1 64-bit bits and Windows 10 64-bit with this problem. The test code is quite simple as followed.

void setup(){
  size(600, 600);
}

void draw(){
  background(50);
  ellipse(width/2,height/2,50,50);

}
@MattGarfield

This comment has been minimized.

Show comment
Hide comment
@MattGarfield

MattGarfield Oct 6, 2015

Tweak Mode reliably freezes Processing completely for me. I used the same test code as @lymanzhang above. On the menu bar, I choose Sketch > Tweak, then click Run and Processing locks up completely. I have to force quit through Task Manager.

I'm running Windows 7, 64-bit. This machine has several profiles on it, I am logged in as the local Admin.

MattGarfield commented Oct 6, 2015

Tweak Mode reliably freezes Processing completely for me. I used the same test code as @lymanzhang above. On the menu bar, I choose Sketch > Tweak, then click Run and Processing locks up completely. I have to force quit through Task Manager.

I'm running Windows 7, 64-bit. This machine has several profiles on it, I am logged in as the local Admin.

@paul-mesnilgrente

This comment has been minimized.

Show comment
Hide comment
@paul-mesnilgrente

paul-mesnilgrente Oct 13, 2015

I have the same problem on ubuntu 14.04 and ubuntu 15.04. Sometimes it crashes, I restart Processing and It works, after it recrashes 1 time, 2 times etc. It seems to be a random behaviour.

paul-mesnilgrente commented Oct 13, 2015

I have the same problem on ubuntu 14.04 and ubuntu 15.04. Sometimes it crashes, I restart Processing and It works, after it recrashes 1 time, 2 times etc. It seems to be a random behaviour.

@erniejunior

This comment has been minimized.

Show comment
Hide comment
@erniejunior

erniejunior Oct 17, 2015

Contributor

Same problem here on Debian. It does not seem to be a Windows specific thing. Are there any instructions on how to get the code generated by tweak mode? Then I could look into it.

Contributor

erniejunior commented Oct 17, 2015

Same problem here on Debian. It does not seem to be a Windows specific thing. Are there any instructions on how to get the code generated by tweak mode? Then I could look into it.

@galsasson

This comment has been minimized.

Show comment
Hide comment
@galsasson

galsasson Oct 18, 2015

Contributor

@erniejunior, to see tweak mode modified code, edit your preferences.txt file and change:

tweak.showcode=false

to:

tweak.showcode=true

the updated code should then be displayed on the console when you run the sketch.

I'm seeing this issue on Ubuntu 14.04 and trying to debug it. On first look it doesn't seem like its related to the modified code of tweak mode.

Contributor

galsasson commented Oct 18, 2015

@erniejunior, to see tweak mode modified code, edit your preferences.txt file and change:

tweak.showcode=false

to:

tweak.showcode=true

the updated code should then be displayed on the console when you run the sketch.

I'm seeing this issue on Ubuntu 14.04 and trying to debug it. On first look it doesn't seem like its related to the modified code of tweak mode.

galsasson added a commit to galsasson/processing that referenced this issue Oct 18, 2015

@galsasson

This comment has been minimized.

Show comment
Hide comment
@galsasson

galsasson Oct 18, 2015

Contributor

Seems to be fixed with the pull request above.
Tested only on Ubuntu 14.04.

Contributor

galsasson commented Oct 18, 2015

Seems to be fixed with the pull request above.
Tested only on Ubuntu 14.04.

@erniejunior

This comment has been minimized.

Show comment
Hide comment
@erniejunior

erniejunior Oct 18, 2015

Contributor

Can confirm that here on Debian too.
Thanks a lot for your work on Tweak Mode by the way. Even though it is still buggy I think it has a lot of potential!

Contributor

erniejunior commented Oct 18, 2015

Can confirm that here on Debian too.
Thanks a lot for your work on Tweak Mode by the way. Even though it is still buggy I think it has a lot of potential!

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Oct 19, 2015

Member

Hopefully fixed for 3.0.1 via #4014 from @galsasson.

Member

benfry commented Oct 19, 2015

Hopefully fixed for 3.0.1 via #4014 from @galsasson.

@benfry benfry closed this Oct 19, 2015

@benfry benfry added this to the 3.0.1 milestone Oct 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment