<div dir="ltr">Hi,<div><br></div><div>The current implementation of Subscription.unsubscribe() uses recursion to unsubscribe the chain of subscriptions. This can lead to a StackOverflowError in case there are many chained subscriptions. Running the following code demonstrates this:</div><div><br></div><div>```</div><div>    void testSubs() {<br>        SimpleStringProperty prop = new SimpleStringProperty("simpel");<br>        Subscription s = prop.subscribe(() -> {});<br>        for (int i = 0; i < 100000; i++) {<br>            Subscription t = prop.subscribe(() -> {});<br>            s = s.and(t);<br>        }<br>        s.unsubscribe();<br>    }</div><div>```</div><div><br></div><div>This results in</div><div>```</div><div>java.lang.StackOverflowError<br>       at javafx.base@26-ea/javafx.util.Subscription.lambda$and$0(Subscription.java:103)<br>     at javafx.base@26-ea/javafx.util.Subscription.lambda$and$0(Subscription.java:103)<br>     at javafx.base@26-ea/javafx.util.Subscription.lambda$and$0(Subscription.java:103)<br></div><div>...</div><div>```</div><div><br></div><div>While it's unusual (and in most cases a very bad idea) to chain that many Subscriptions, I don't think this should give a StackOverflow Error. I believe it is better to avoid recursion in the implementation. If people agree, I'll file an issue for this.</div><div><br></div><div>- Johan</div></div>