JSscripting: Error message "Java.lang.OutOfMemoryError: Java heap space"

Excellent. Will try this, too.
Thank you very much

Good point I will try it by myself but do you think that the problem just delays or is OpenHab also cleaning the used memory?

I suppose each of you could try to find out.
Useful background info in this thread -

Good point I will try it by myself but do you think that the problem just delays or is OpenHab also cleaning the used memory?

Not OpenHAB it cleaning unused memory. The JAVA garbage collector is doing it. Just try it. I don’t want to say that it solves also your problem.

It will not solve the symptoms nor is it the root cause of the problem.
I‘d say it pushes the symptoms of the problem to a later point of time (which is to me a kind of solution):grinning:

The thing is you, the user, has to properly describe and identify the problem in the first place before you know where to properly address an information he thinks to be of value to.

The 3.2 release thread and even more so GitHub aren’t for problems as long as it is unclear what your problem really is about in terms of code, i.e. which component misbehaves.

The common understanding problem on this starts very early in the communication process:
Most what users consider to be a problem does not match those criteria.
I understand this can be frustrating to users because they are looking for help they do not get or to someone like you that wants to help but does not know where to turn to.
Then again, only when you identify a problem (in terms of code, not from the user’s point of view) and what component it is with, you will know where to address it, and you will also get the appropriate attention. The crux is about identifying problems without knowing enough of the inner workings of openHAB and that there’s noone to guide you through that.

Here for instance, when Java is spitting out of mem errors, this is NOT an OH problem because Java wants to use more mem than it is configured to use at most.
There might be a mem leak in OH as the underlying problem but as long as you have not properly identified that leak exists, it is not a problem in terms of code.
So for now you shouldn’t be asking for help on either of these channels because that might be annoying and hindering the volunteers over there.

Most of the time Java-out-of-mem is a user-caused problem because the limit depends on hardware, JVM, OS configuration, which are any user’s own responsibility to get right
openHABian defines a standard limit, too (right, you can set in EXTRA_JAVA_OPTS as mentioned above) and it’s not impossible that this default does not work for everybody.
But given the number and size of working installation with openHABian it is highly unlikely that you are the first user this is insufficient for.
So return to analysis and look for a mem leak instead.

Please pay attention to being helpful in the first place. You may not expect anyone to read your post to know the context of your system so comprehensively state it in the first place and keep repeating to state that whenever the information might be useful to an unknown or new-to-the party person that might want to help you.
Remember #1 from the post below: this is not a help desk, and there’s no ticket system.
There’s only this thread, and you should not spread information. Update post #1 of a thread when there’s relevant news.
Noone wants to waste his time digging through older posts just to get the current context right.

How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

we can continue this discussion forever.
There are no problems with M5. After updating to Release build many users like myself had a problem. So it IS related to latest build.
If you read through my post, I am NOT requesting help.

I just wanted to bring this to a developer‘s attention where I think of it might be of interest. obviously it wasn‘t. No big deal. I was not complaining anything and I did not require further help or anything what you have detailed out in your post.

If I am complaining something then it is YOUR approach which I PERCEIVE as being offensive, and I want to point out just for escalation reasons, that I am not saying that your are offensive but I perceive it this way.
I have decided not to provide information about problems with OH anymore. This is just a reaction of how I perceive your activity. I hope that not more users will follow my example and I really hope that I am the only one who is perceiving it this way.


As long there is no evidence for a memory leak somewhere, it can solve it. At least in my case it looks now much better…

These types of problems are notoriously difficult to track down. I spent dozens of hours on one last year, and I’m a developer.

The best thing you can do as a non-developer is to show as simply as possible how to reproduce the issue. If a developer can’t make it happen themselves there’s almost no hope of tracking down the root cause.

There also are some very simple command line tools that can show memory and cpu utilization over time. I’ll try to share those shortly, but maybe not for a bit as I’m in the middle of moving into a new house.


Mark’s summed up the situation very well in his post above. If you can list the steps necessary to reliably recreate the error then it makes it easier (not easy but easier) for a developer to investigate. This needs to start from first principles, i.e. start with a basic OH install, then install JS Script, then create this rules file in this directory, then create this rule with this deliberate syntax error and save it, then watch the Java memory usage increase. That sort of thing.

I remember there was a Java memory leak in 1.6 or 1.8 that caused me problems for a long time. Sometimes Java ran out of memory a few hours after a reboot, sometimes a few days after a reboot. I worked around it by using the exec binding and a rule to restart openHAB every night at 1am. It didn’t solve the error but it prevented it from happening most of the time. (In the end someone discovered that leaving browser windows open at the PaperUI caused the issue so once I remembered to close browser tabs the issue didn’t reoccur.)

In summary, if you can explain how to recreate the error that would be excellent. In the mean time, it also might help you to use the exec binding to schedule a restart of openhab.

Hey Mark @mhilbush and Steve,
thank you very much for your moderate words.
Well, the problem can reproduced fairly easy. All is written from several users in the first half of this thread.
Furthermore there is a link to another post, where the same problem is described including a short description how to reproduce the problem.
(In short: create a faulty JS script and execute it a couple of times).

I have re-posted both links in the release thread AND I have created a bug issue where I described everything again.
I think that is enough for the moment. If you want to fix this problem then I am more than happy to contribute, test, etc. and do everything you need.
But I will NOT do in advance all the stuff stormi is requesting, as I am not asking for help.

Again, my intention is to raise hand and say, attention - there is a problem. If nobody cares that’s fine with me. If a developer requests support, I do whatever I can to help.

Just as a side note. Neither in this thread, nor in the other thread linked bove, nor in the release thread, nor on Github not a single developer, maintainer, whoever, took notice and was asking a single question.

My personal point of view is that we should start acting like a community. We, users, see problems, we report them, users who are able to fix these problems are requesting infos which we in return provide. That makes sense. That approach takes us, normal users, into the game of fixing problems.
That approach what is described above is at least to me, not feasible and irritating, so that I will refrain from posting new potential problems.


I totally agree. I also have the feeling that people who are using openhab with fun but may not have the same knowledge as the people who are involved in the development, are more and more pushed to leave this place. Very, very german rules here now!

A bit sad. And I don’t know if this is good for the project finally…

But anyway: Let us help each other as good as we can and see the positive sides…:slight_smile:

Still fun and thanks to all the developers who contribute to OpenHAB. Great work guys!!
I am sure most of them are happy with the users, who have fun with the SW everyday and give some feedback… Even if they are not following all the rules given in the forum…

1 Like

Well I am still with OH 2.5.12 and I have the heap space problems with the cpu up to 100% and than OH restart by itself.

ummm… Mark, who posted above is a developer. He actually is the guy who figured out a very similar problem with DSL rules when they had errors in them. Here is a link to that issue (about a year ago)

The thread T linked to in the second post in this thread has several developers involved.
Please understand, everyone here wants to help you and just because folks don’t post here in your thread doesn’t mean they aren’t reading this thread and following along.
There are a few members here who can be a little… ah… terse, but don’t judge the entire community based on a few (or even one) individuals. I also didn’t think it was necessary to split your post out of the release thread but it was a (perhaps overzealous) attempt to keep the thread focused.
I think I might have already asked you but if not, can you please put a link to your github issue in this thread? Have your included a ‘steps to reproduce’ in the issue as described by Steve two posts above yours?
As mentioned, these types of issues are difficult to debug.

1 Like

Since Oliver hasn’t replied I thought I’d have a look for it. I think it’s this one: [JS scripting engine] Memory Leak #11952

1 Like

I tried to fade out this thread…
But thanks.

which is correct. I added it to the other thread:

1 Like

Should be solved now ([jsscripting] Fix memory leak that crashes openHAB by florian-h05 · Pull Request #13824 · openhab/openhab-addons · GitHub).
Can you please try and then mark this topic as solved?

for me the issues is solved now and does not occur with 3.4.1 anymore,

big thanks to @florian-h05

1 Like

had exactly the the issue - OH continmues to run, but the website reacts extremely slow or stay blank.
And this WITHOUT using any rules addons.

If you experience this issue without any automation addons installed, it can’t be JS Scripting.

Can you please give us all information from the technology section of the About page of MainUI (you need to be logged in as admin).