Metadata source, global scripts and updateing does not working as they should on MangoES
-
Hi everyone,
I am having trouble with one of my MangoES instances.
Mango modules updates
When trying to check for upgrades in the modules section mango throws an error:
“Your instance cannot be upgraded due to a versioning problem: store.infiniteautomation.com: unknown error”.
It seems strange because I managed to update it around 3 weeks ago without problems. To note, the only thing what changed is that I gave MangoES to a client who set it up but then the problems started with it. I checked logging module to see if Mango throws a more detailed error about what could be happening.
This is the error which Mango throws after the error has been executed
ERROR 2016-10-24 20:53:33,007 (com.serotonin.m2m2.web.dwr.ModulesDwr.versionCheck:121) - java.net.UnknownHostException: store.infiniteautomation.com: unknown error at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:908) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1303) at java.net.InetAddress.getAllByName0(InetAddress.java:1256) at java.net.InetAddress.getAllByName(InetAddress.java:1172) at java.net.InetAddress.getAllByName(InetAddress.java:1106) at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:44) at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:102) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) at com.serotonin.web.http.HttpUtils4.executeWithRetries(HttpUtils4.java:174) at com.serotonin.web.http.HttpUtils4.getTextContent(HttpUtils4.java:132) at com.serotonin.m2m2.web.dwr.ModulesDwr.getAvailableUpgrades(ModulesDwr.java:238) at com.serotonin.m2m2.web.dwr.ModulesDwr.versionCheck(ModulesDwr.java:110) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.m2m2.web.dwr.util.TranslationsFilter.doFilter(TranslationsFilter.java:37) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.m2m2.web.dwr.util.ExceptionDetectionFilter.doFilter(ExceptionDetectionFilter.java:26) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at com.serotonin.m2m2.web.dwr.util.DwrPermissionFilter.doFilter(DwrPermissionFilter.java:45) at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431) at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283) at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83) at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:300) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745)
Also to note that while I was using the instance in our office the router address is 192.168.1.1, the client router is 192.168.8.1 . Maybe that can be the cause? As I only changed the network settings after I installed it to my client to get access to the internet. I will check tomorrow after I have collected MangoES and started it in our office again with the 192.168.1.1 gateway maybe that is the cause but it seems rather unlikely that the gateway is influencing the Mango instance.
Metadata source and global scripts
Also the Metadata source is acting very strangely.
Problem 1 while using global scripts
I am using a global script which I have used before on other Mango instances and on this instance the result = 0 while using the global script. When I copy the script to the point scripting area and change the variables according to the point then the point calculates correctly and the scripting check passes as a success.
Problem 2 while using context update
While I had to change the points scripts to not use the global scripts to get them to work another problem popped out. As I need the points to use Context Update they do not update as they should. They will stay as the last value or "The source point has no value". As of right now I found that I can use as a temporary solution cron pattern update with an interval every second but I definetely cannot leave it like that because it is not optimal. A few posts ago I came up with a problem that the meta data source is influencing Mango operations I set up these points according to your instructions.
Check 1 point to update context per data source in one point. As I only using 1 data source to get my raw data I have checked only one point as your instructions were.
I am not logging the points which I am using to create a meta data point and I am not logging the meta data points either. I tried to log the points but it still gave me no results.
The settings which I would like to use:
Modbus points:
Do not log, cache 2 values
Update interval on the Modbus datasource 1 second.Meta data points:
Do not log, cache 2 values
I would like to note that I have used this kind of a setting on an another MangoES instance and everything worked fine.
As of right now I still can backup my json and create a new Mango installation on the MangoES but I do not want to lose the license of the MangoES. Also to note that I would need a solution asap.
I am ready to give someone from Infinite Automation access to the instance if they want to see what is happening.
Thomas,
-
update the DNS server on the mango ES for the first problem
-
Hi Thomas,
I believe Craig steered you correctly on the first point, so thanks @craig for contributing!
Can you verify for me that you've got at least version 2.2.4 of the Meta data source, and I'm sure you have version 1.5.1 of global scripts.
Regarding problem 1, I would troubleshoot that by watching your logs and putting print statements into the global script and then hitting the validate check on the meta point after saving each one. It sounds like you're using a function in the global scripts to compute something on the value? Perhaps a print in the function body of whatever you're calling? Is it possible to post the global script and the meta point script this is occurring on? I assume because this is an ES you are running on an Oracle JDK8.
print("First line of global scripts!"); ... function add6(num) { print("Inside function add6!"); return num + 6; }
Prints should be visible below the script dialogue, and you can also use log.trace("Message") to print to a log for the point, if logging is enabled below that statement's level.
Regarding problem 2, I am thinking you probably have a version < 2.2.4 of the Meta module.
-
Hi Phil,
As we are on different timezones its morning for us I will be brief.
The 2 scripts which I am using in the points is here
function ds(kl,mk,on1,on2,end1,end2) { if (mk.value===true ){return 2} //mootorikaitse - kollane if (kl.value===false ){return 3} //kaitselahutus - sinine if (end1.value===true && on1.value === false ) {return 1;} //Lõpulüliti 1 on sees ja pinge 1 puudub if (end2.value===true && on2.value===false) { return -1;} if (on1.value===true || on2.value===true && end1.value===false && end2.value===false) {return 11;} //Lõpulüliti 1 on sees ja pinge 1 olemas } function DamperStatersk(mk,on1,on2,end1,end2) { if (mk.value===true ){return 2} //mootorikaitse - kollane if (end1.value===true && on1.value === false ) {return 1;} //Lõpulüliti 1 on sees ja pinge 1 puudub if (end2.value===true && on2.value===false) { return -1;} if (on1.value===true || on2.value===true && end1.value===false && end2.value===false) {return 11;} //Lõpulüliti 1 on sees ja pinge 1 olemas }
The points are binary and the metapoints are used for front-end development. For the version. I am using 2.2.4.
The prints which you suggested work fine. The prints are being called out when I call the function so my guess is that the global-scripts is working fine. The problem seems to be that meta data source fails to calculate the value.
-
I do not see your Meta Point's script. Pardon then asking, but I wonder if you are possibly not returning a value from the Meta point's script body? Something like
return DamperStatersk(...);
You will get a value of zero, false or "" if you validate an empty script window, so that's the behavior when a value isn't explicitly returned.
There is a terse description of the bugfix in 2.2.4 here: https://github.com/infiniteautomation/ma-core-public/issues/679 . The problem was caused by disabling and re-enabling points that were not updating the context. I don't know if that's helpful toward the odd updates you were describing.
-
Hi Phil,
I have these two scripts in my global scripts so I can call them out in the datapoints. Note, after every if clause there is a return.
I am calling them out in the datapoints like this
Damperstate(p538,p537,p539,p540,p592,p594);
So the function should work then. I am sure the scripts have to work because I am using the exact same function on my other MangoES instance and everything works fine.
I will look into the github issue as the problem maybe because of the disable/re-enabling. But I cannot see the bugfix there? As I can only see the description and that the problem has been closed and fixed.
Thomas
Edit - The first issue about updating has been fixed with adding DNS servers. Thanks.
The problems with meta are still open.
Note: By adding return in front of the function as you suggested seems to give me a different result. Will keep you updated if the result is correct!
It seems all the problems have been resolved hopefully. Will test the system for a day and post the result at the end of the day. It seems that you can say that I had "return blindness" in coding. Sorry for the trouble.
Many thanks to you Phil.