# Potential Bug - Processing compiler becoming unresponsive with negative text size

**URL:** <https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988>\
**Category:** Processing\
**Created:** [November 27, 2018, 10:42am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988 "2018-11-27T10:42:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [November 27, 2018, 10:42am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/1 "2018-11-27T10:42:11Z")

</div>

Hi,

I’m not sure if this a simple coding issue, or a bug, but I’ve recently when experimenting with `textSize();`, my Processing IDE froze, was unable to start any new program, and couldn’t even quit properly on my Macbook.

When I’ve run the program, an Exception was thrown: `java.util.EmptyStackExceptionException in thread "Thread-1Exception in thread "`.

Here is the code that caused the exception :

```auto
float size = 500;

void setup() {
  size(600,600);
  textSize(size);
  while (true) {
    textSize(size);
    size--;
    println(size);
  }
}

```

I’m not sure if it’s just me, and it would be nice to see if other users are experiencing this before I make a bug report on GitHub.

Thanks!

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [November 27, 2018, 11:05am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/2 "2018-11-27T11:05:40Z")

</div>

What is the while loop meant to do?! You’ve created an infinite loop which is taking up most of the CPU time on your machine. In general, never use `while (true)`

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [November 27, 2018, 11:10am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/3 "2018-11-27T11:10:49Z")

</div>

I’m just using `while (true)` as an example, in my real code, the loop will run around 100 times and still causes me to experience the same error.

```auto
float size = 10;

void setup() {
  size(600,600);
  textSize(size);
  int i = 0;
  while (i < 1000) {
    textSize(size);
    size--;
    println(size);
    i++;
  }
}

```

Also is sufficient.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [November 27, 2018, 11:38am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/4 "2018-11-27T11:38:47Z")

</div>

OK, the loop still doesn’t make much sense. But why do you expect to be able to set a negative text size? What would that mean?

---

<div class="post-metadata">

**Author:** ![bryan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bryan/32/2538_2.png) [@bryan](https://discourse.processing.org/u/bryan)\
**Post date:** [November 27, 2018, 11:40am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/5 "2018-11-27T11:40:19Z")

</div>

> [@Sarah](#):
>
> float size = 10; void setup() { size(600,600); textSize(size); int i = 0; while (i \< 1000) { textSize(size); size–; println(size); i++; } }

i got this:

> -1.0  
> textSize(0.0) ignored: the text size must be larger than zero  
> -2.0  
> textSize(-1.0) ignored: the text size must be larger than zero

i don’t know what you want to achieve with a negative textSize, probably something like a 180° rotation i guess, but who knows. i tested your code in a windows computer

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [November 27, 2018, 12:08pm UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/6 "2018-11-27T12:08:49Z")

</div>

I don’t want to achieve anything with a negative text size, but the Processing compiler should still be able to handle it. I’m not using the above code for anything, it’s just the shortest way I could find to create the error.

My Processing freezes on that code, so it must just be my laptop.

Thanks!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 27, 2018, 12:15pm UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/7 "2018-11-27T12:15:31Z")

</div>

- [Forum.Processing.org/two/discussions/tagged?Tag=println()](http://Forum.Processing.org/two/discussions/tagged?Tag=println%28%29)

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [November 27, 2018, 12:36pm UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/8 "2018-11-27T12:36:43Z")

</div>

Thanks - looks like it’s not related to text size at all. 😑

Do you know why the error pops up or what it means?

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [November 27, 2018, 12:38pm UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/9 "2018-11-27T12:38:07Z")

</div>

> [@Sarah](#):
>
> I don’t want to achieve anything with a negative text size

Yes, that’s what’s confusing everyone! 😄

It seems that alternating output to System.out and System.err breaks PDE. Interesting!

Following sketch also replicates for me

```auto
for (int i=0; i < 1000000; i++) {
    System.err.println("ERROR");
    println("out");
}

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [November 27, 2018, 2:34pm UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/10 "2018-11-27T14:34:39Z")

</div>

> [@Sarah](#):
>
> my Processing IDE froze, was unable to start any new program, and couldn’t even quit properly on my Macbook.

That sounds terrible. Thanks for debugging rather than running away screaming.

You are right that almost anything with that behavior should be considered a bug – a Processing user should, ideally, not be able to take down their operating system by making a simple syntax error or logical error – for example passing textSize(mouseX -10) can make sense to someone who isn’t thinking specifically about the textSize(-1) case.

That said, glad that textSize wasn’t the issue.

Re:error spam locking up the sketch. Processing used to have severe problems with repeated println locking up the console – I believe this was mitigated with throttling, but your problem might be related. Did you open an issue?

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [November 28, 2018, 7:55am UTC](https://discourse.processing.org/t/potential-bug-processing-compiler-becoming-unresponsive-with-negative-text-size/5988/11 "2018-11-28T07:55:36Z")

</div>

Opened an issue just now, waiting for an reply:

> <https://github.com/processing/processing/issues/5714>

Thanks everyone for your help!
