# Restart Gateway fixed issue but is there a better way. Fun with API calls

**URL:** <https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171>\
**Category:** Ignition\
**Created:** [January 30, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171 "2023-01-30T19:08:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duggan639](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@Duggan639](https://forum.inductiveautomation.com/u/Duggan639)\
**Post date:** [January 30, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/1 "2023-01-30T19:08:22Z")

</div>

So I am new to dealing with Ignition and inherited this Ignition install from a former Engineer who set this up for the project before I started at my current company and he is no longer apart of the company.

So I am still new at troubleshooting Ignition issues. There are alarm scripts that send API get request and posts to another server when certain conditions happen. I noticed on of them did not trip over the weekend as expected. When I looked at the alarm setting this is what was showing.

 ![Screenshot 2023-01-29 093818-2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/b/3be8b006ba8c594f9ca522c12cc3f1670c985ed7.jpeg)  
When I loaded the code up into the script console in designer it ran just fine. So I attempted to trigger the code by setting a new alarm. It through this error again. I tried a few things with no success then got the idea to log into the gateway on the remote server and restart ignition. But I figure there is a better way to deal with this issue or does the Gateway need to be restarted on a scheduled basis?  
Thanks in advanced for any help or advice

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 30, 2023, 7:22pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/2 "2023-01-30T19:22:45Z")

</div>

"Unable to GET" is unfortunately not much to go on at all. Are there any error messages in the general gateway logs?

---

<div class="post-metadata">

**Author:** ![Duggan639](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@Duggan639](https://forum.inductiveautomation.com/u/Duggan639)\
**Post date:** [January 30, 2023, 8:44pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/3 "2023-01-30T20:44:24Z")

</div>

Does this help this the error log pulled from the gateway:

 ![Screenshot 2023-01-30 133123-2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e6dd8c31d2527a4691f8cff725190686049f438.jpeg)  
 ![Screenshot 2023-01-30 133320](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f260636159c63f122d64dad9b13bb67e61a5a501.jpeg)

If not let me know or more exactly what you looking for that would help!

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 30, 2023, 8:46pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/4 "2023-01-30T20:46:22Z")

</div>

It would be better to copy and paste the text and format it with the `</>` button then pasting screenshots.

---

<div class="post-metadata">

**Author:** ![Duggan639](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@Duggan639](https://forum.inductiveautomation.com/u/Duggan639)\
**Post date:** [January 30, 2023, 8:52pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/5 "2023-01-30T20:52:16Z")

</div>

Like this:

```auto
dispatcher	30Jan2023 10:43:05	([default]BBW01_CombinedTags/BBW01_AccE_BM_VoltageSAvg, alarmActive) Error executing tag event script: java.io.IOException: java.io.IOException: Unable to GET https://api.<Omited due to confidential>

```

```auto
com.inductiveautomation.ignition.common.script.JythonExecException: java.io.IOException: java.io.IOException: Unable to GET https://api.<Omited due to confidential>
at org.python.core.Py.JavaError(Py.java:547)
at org.python.core.Py.JavaError(Py.java:538)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:192)
at org.python.core.PyObject. __call__ (PyObject.java:422)
at org.python.core.PyMethod.instancemethod ___call__ (PyMethod.java:237)
at org.python.core.PyMethod. __call__ (PyMethod.java:228)
at org.python.pycode._pyx56.getMachineIDs1$8(:60)
at org.python.pycode._pyx56.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
at org.python.core.PyFunction. __call__ (PyFunction.java:416)
at org.python.pycode._pyx56.alarmActive$1(:99)
at org.python.pycode._pyx56.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyFunction.function ___call__ (PyFunction.java:474)
at org.python.core.PyFunction. __call__ (PyFunction.java:469)
at org.python.core.PyFunction. __call__ (PyFunction.java:464)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:849)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:831)
at com.inductiveautomation.ignition.gateway.tags.scripting.TagScriptManagerImpl$FunctionInvokerImpl.run(TagScriptManagerImpl.java:530)
at com.inductiveautomation.ignition.gateway.tags.scripting.events.AbstractTagScript.invoke(AbstractTagScript.java:34)
at com.inductiveautomation.ignition.gateway.tags.scripting.TagScriptManagerImpl$Task.invoke(TagScriptManagerImpl.java:479)
at com.inductiveautomation.ignition.gateway.tags.scripting.TagScriptManagerImpl$TagScriptDispatcher.run(TagScriptManagerImpl.java:442)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:539)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: java.io.IOException: java.io.IOException: Unable to GET https://api.<Omited due to confidential>
... 31 common frames omitted
Caused by: java.io.IOException: Unable to GET https://api.<Omited due to confidential>
at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:103)
at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.get(JythonHttpClient.java:306)
at jdk.internal.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:190)
... 28 common frames omitted
Caused by: java.net.ConnectException: Cannot assign requested address
at java.net.http/jdk.internal.net.http.HttpClientImpl.send(Unknown Source)
at java.net.http/jdk.internal.net.http.HttpClientFacade.send(Unknown Source)
at com.inductiveautomation.ignition.common.script.builtin.http.JythonHttpClient.send(JythonHttpClient.java:101)
... 33 common frames omitted
Caused by: java.net.ConnectException: Cannot assign requested address
at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Unknown Source)
at java.net.http/jdk.internal.net.http.PlainHttpConnection.connectAsync(Unknown Source)
at java.net.http/jdk.internal.net.http.AsyncSSLConnection.connectAsync(Unknown Source)
at java.net.http/jdk.internal.net.http.Http2Connection.createAsync(Unknown Source)
at java.net.http/jdk.internal.net.http.Http2ClientImpl.getConnectionFor(Unknown Source)
at java.net.http/jdk.internal.net.http.ExchangeImpl.get(Unknown Source)
at java.net.http/jdk.internal.net.http.Exchange.establishExchange(Unknown Source)
at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl0(Unknown Source)
at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl(Unknown Source)
at java.net.http/jdk.internal.net.http.Exchange.responseAsync(Unknown Source)
at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(Unknown Source)
at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsyncImpl$7(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniHandle(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniHandleStage(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.handle(Unknown Source)
at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(Unknown Source)
at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsync0$2(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.completeAsync(Unknown Source)
at java.net.http/jdk.internal.net.http.MultiExchange.responseAsync(Unknown Source)
at java.net.http/jdk.internal.net.http.HttpClientImpl.sendAsync(Unknown Source)
... 36 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Unknown Source)
at java.base/sun.nio.ch.Net.connect(Unknown Source)
at java.base/sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at java.net.http/jdk.internal.net.http.PlainHttpConnection.lambda$connectAsync$0(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
... 59 common frames omitted

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 30, 2023, 10:04pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/6 "2023-01-30T22:04:57Z")

</div>

> [@Duggan639](#):
>
> ```auto
> Caused by: java.net.BindException: Cannot assign requested address
> 
> ```

What version of Ignition are you using? Also, are you able to share the code in the project library script? If you're on 8.1.16 or higher, you can explicitly set the `version` parameter to HTTP\_1\_1, which prevents a potential socket leak in the underlying Java HTTP client implementation. You should also prefer to recycle the same `httpClient` instance as much as possible; I don't know if the script is written to do that or not without seeing it.

---

<div class="post-metadata">

**Author:** ![Duggan639](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@Duggan639](https://forum.inductiveautomation.com/u/Duggan639)\
**Post date:** [January 30, 2023, 11:08pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/7 "2023-01-30T23:08:30Z")

</div>

Looks to be 8.1.10 currently. I will look into the steps to update it, its in a docker container. I am paranoid about this install since i inherited from some one else and want to avoid having to redo everything, if you know what I mean. Can I dm the script, not sure I want it openly posted on a forum.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 30, 2023, 11:16pm UTC](https://forum.inductiveautomation.com/t/restart-gateway-fixed-issue-but-is-there-a-better-way-fun-with-api-calls/69171/8 "2023-01-30T23:16:29Z")

</div>

Sure, you can DM me, I just want to take a quick look at how it's written.

I would definitely recommend upgrading sooner rather than later, for a variety of reasons, but I totally understand wanting to be cautious about a production system you're inheriting.
