-
Notifications
You must be signed in to change notification settings - Fork 783
-
Notifications
You must be signed in to change notification settings - Fork 783
ESH Xtext 2.9.2 –> exceptions #1393
Comments
it also happens for:
|
Well, this sounds as if something in your rule is null when you execute it. Would be good if you could analyze this (e.g. add logging messages) and to come up with a rule, which clearly shows that there is a bug in the rule engine. |
well ... I am not too deep in OH yet ... since this rule had no exception for weeks and this exception is new since the build that consisted the xtext update I thought its related. also only these 2 of my rules (of ~15 rules) do throw an exception. additionally ... the rules with the exception do the expected and work anyways. since @kaikreuzer said there is something NULL I just grepped all values from my 2nd comment example. -->
all "states" from all items uses in the rule are not null... still the exception is triggered for any hints I can do a better analysis I am more then open to do it. |
@shorty707 I think it is clear that the error has been triggered by the Xtext update. IMHO the question is if it is a bug or just a changed behavior (timing, ...) that caused the exception. |
Looking at the line 44 is assume that the real error is hidden ATM @Override
public void run() {
super.run();
try {
result = script.execute(context);
} catch (ScriptExecutionException e) {
String msg = e.getCause().getMessage();
if (msg == null) {
logger.error("Error during the execution of rule '{}'", getName(), e.getCause());
} else {
logger.error("Error during the execution of rule '{}': {}", new Object[] { getName(), msg });
}
}
} The exception you see is the line "String msg = e.getCause().getMessage();" that should prepare the logging of the exception of the real one. |
@maggu2810 thanks I tried to alter the rule a little but did not manage to avoid the exception or find a pattern why only these 2 rules are affected |
I will try to fix that line(s) and I hope we will get a more information then. |
@shorty707 Download the file "org.eclipse.smarthome.model.script-0.8.0-SNAPSHOT.jar" from here (https://drive.google.com/file/d/0Bx99QXY8p6gvSWlYRDF5eE84cUE/view?usp=sharing) and store it to some location on your drive. In your Karaf container use After that restart your container and let's look at the log output. |
|
Do you see this on the startup phase only or also after the system is running for a while? |
If this is correct it is related to #870 and it could be solved by using DS to "know" the correct time to start script execution (also related to the startup rule solution then). |
no its thrown all the time. there is one thing to mention additionally. a. when I save the rule file AFTER the system started also the same exact error comes up but the rule executes fully (the last line in the rule actually comes directly after the exception. but the exception is always thrown and wont stop also after hours |
on startup I now logged this:
|
* Do not cut of script exception This is related to: #1393 (comment) PR: #1405 Signed-off-by: Markus Rathgeb <maggu2810@gmail.com> * show message of exception (cause could be null) Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
AFAIK the message |
still no clue if its related to my exception. for my ininital post the rule has no more exception. the exception for the rule from comment 2 (rule "Gruppe AlleTempwerte auf extrem Werte überwachen") the exception keeps coming |
Don't know if this is related to the openHAB distribution or some of the openHAB bundles. Will try to reproduce it. |
@kaikreuzer The message disappeared on openHAB after some changes. Sure, I have not done any real tests until now, just checked "bundle:list" and "scr:list" and the log. What is the reason for all that lazy activations at all? Ah and do you remember: |
Okay, I have found out how to get the tests working again. Need just some time to fix all tests etc. |
@shorty707 Okay for you to test an openHAB offline distribution I create for you? |
@shorty707 Please test 😉 https://drive.google.com/open?id=0Bx99QXY8p6gvQkU5ZnRoWTF3Wm8 |
I also cannot make the circular dependency exception appear anymore with this build - so that looks pretty good to me! |
@maggu2810 ok will test and let you know |
|
Okay @shorty707, so this error is still not solved. And we will continue to inspect your error. Is there some private stuff in your runtime or could you give me a copy so I can start it on my system? |
can zip and upload to gdrive need all or just the conf folder? |
If you give me all, then I can filter myself and we do not miss something. |
You don't have to import org.joda.time.* in ESH? What happens if you only |
That is working, see above: |
Using |
mmm.... since
seems to not work either, this might mean there is a problem importing org.joda.time in the first place? I tend to use jodatime quite a bit to store DateTime during rule execution, and then have something like
Is there an alternative approach that can be pursued? |
I have a look at the sources to improve the error logging.
That is a little bit wired. But it seems that using the correct imports etc. also this error could be resolved, so I don't think the rules are broken now. They are perhaps more strict and without good logging. |
Anyone any progress on this? Sorry to be bitching about this, but to me this sounds as a critical issue for which we do not have a solution yet, besides downgrading xtext.... It renders the Karaf based runtime useless in an operational environment. |
I assume that the situation (lack of man power etc.) is still the same (see: #1393 (comment), #1393 (comment)). I am afraid that nobody currently works on improving this situation (enhance logging etc.). Any volunteer is welcome. |
@maggu2810 @kaikreuzer @R-Edelhoff @chriskn @SJKA I fully understand the lack of manpower/time at hand, let us then please revert to an older version of Xtext in the meantime? For me it is essential to have Rules/Script working so that I least I can test new code (migration to new scheduler, migration of existing userland Rule engine to Automation Rule Engine, CalDAV server Rule scheduling) against a real environment. |
Did anybody come up with a reproducible scenario that would help to analyze the problem? I mean simply a tweaked demo.rules file from the demo setup, without requiring any further special setup besides the demo installation? |
@kaikreuzer @maggu2810 In the process of setting up a test environment in the IDE, i discovered that exceptions (with the famous "Script interpreter couldn't be obtain") are thrown at simple initialisation statements at the beginning of the .rules files.For example, declaring a global variable like |
Ok, I think we are coming closer - this very much sounds like a similar cause as #1575. |
well yes, I have to take back what I wrote as I can not replicate that bit anymore. in the IDE now, when I have an almost empty .rules things are running fine. I can add additional Rules to the .rules file (while the runtime is running) without a problem. When I now stop the runtime, and start again, I run again into that Exception. to me it seems that something fishy is going on with respect to variable initialisation. The exception get's thrown (sometimes) at line 61 of the RuleContextHelper:
as if injecting new variables in the context is failing. (this is what I noticed when making there earlier comment on declaring global variables, but again, now I can not replicate it anymore) This is truly frustrating stuff :-( |
FYI Xtext 2.10.0 is released. Should we now upgrade or downgrade? |
Ok so what shall we do then? |
I have spend the last days to get the Designer in a usable state again. The latest snapshot builds should work again (at least the Mac version does for me) and it nicely highlights all errors that exist within the rules. And as we can see from the discussions above, many issues seem to be due to invalid rule syntax. Being the only reproducible example that I was able to find in this thread, I tried this one. I indeed had the script execution error. But at the same time the Designer tells me that it cannot resolve DateTime and that it needs to be imported. Adding a
at the top of the rule file makes this error marker disappear in the Designer and at the same time the execution error vanishes from the runtime and the rule is nicely executed. So I'd very much recommend everyone to try out the new Designer build and check your rule syntax with it. If you now can come up with a reproducible example, which does not show any errors in the Designer, I will help on the further analysis as good as I can. |
@kai will do and feed back (the example you mention, at least in my copy of the code, does have the import). At least we then can root out syntax errors |
@kai @maggu2810 Here below are some items flagged by the editor. It would be good to flag them as an issue, or not, (or suggest a solution) with the objective to document these somewhere for other users:
3.
Apart from that I indeed had one syntax error in my file (a missing ) bracket), and strangely enough that was not flagged by the previous version of the XText parser. |
This issue gets very long now. A different behaviour between ESH + the ESH based solutions (e.g. openHAB) and OH1 is perhaps more related to the https://github.com/openhab/openhab-docs/ project. The bugs that could be solved / found by the Designer are obsolete, too. WDYT if we close this one and create separate ones, that needs to be fixed? I added a label "Rule" which we can use to tag that issues. |
As @maggu2810 suggested, I am closing this issue and we track the more specific issues. |
Considering:
the output of :
is 2016-07-14 19:48:00.945 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'openHAB Host Volume Control': null Sound to me that the Action is not working (latest snapshot) (there are no import statements, as per documentation) |
@kgoderis I can reproduce this. Checking
I see that the audio action is not registered as a service - so that is some issue in the compat bundle. As I am anyhow refactoring the whole audio stuff right now, give me a few days and I will make sure that it works again in the new version. |
Hello, I have: 2016-09-04 17:21:51.105 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test.rules' For the first day it was working, then they give this error. `
end |
I also receive this when using the Pushover service. The rule itself is very simple and is really just in place to give me confidence in the sensor:
and the error:
It seems to work fine for the first day or so, and then stops functioning. |
@mdeneen looks like you are missing the 'then' in the rule? |
the latest changes from ESH bumped xtext to 2.9.2
some of my rule do throw now: (they worked flawless before)
example rules with exception since 2.9.2
The text was updated successfully, but these errors were encountered: