# Uncaught exception from mysql nodes

**URL:** <https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732>\
**Category:** General\
**Created:** [27 February 2021 19:10 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732 "2021-02-27T19:10:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [27 February 2021 19:10 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/1 "2021-02-27T19:10:46Z")

</div>

Hi !

Is there anyone, who has some experience with the mysql node? My problem the whole node-red randomly shutting down thanks to a uncaught exception, which caused by the mysql node.

Here it is a screenshoot, about what exactly happend.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/fa9dcf135595115d46dc337da7c08113d33e2384.png)

Someone know how the fix that ? Because it's very anoing problem, and thanks for that the whole system is unstable.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 February 2021 19:26 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/2 "2021-02-27T19:26:56Z")

</div>

Which mysql node are you using?  
Which version of node red?  
Which version of nodejs? Use `node -v` to find out.

Edit: Also which version of the mysql node?

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [27 February 2021 19:53 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/3 "2021-02-27T19:53:43Z")

</div>

mysql node: node-red-node-mysql v0.1.1  
node red: v1.2.7  
node js: v12.19.0

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 February 2021 22:09 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/4 "2021-02-27T22:09:58Z")

</div>

What device is NR running on?  
What device is MySQL running on?  
Do you know if the database has restrictions on it? (like time limits for connections - if this is a corporate DB you may have to talk to your DBA))  
How often are you using the node?

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [27 February 2021 22:43 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/5 "2021-02-27T22:43:27Z")

</div>

The NR and the MySQL is running on the same device, which is currently my laptop. It's running Win 10 and the MySQL is running as part of the XAMPP.

Currently i dont know that, have any time limit set in the SQL, but i will definitely check it.

If your last question is tend to, how often use the sql nodes, then my answer is pretty often. My devices, which running on batteries every 3 minutes send message and then doing insert with data which send it. Then few seconds later the system doing a select query. Both the select and the insert query i use separate mysql nodes.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [28 February 2021 00:06 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/6 "2021-02-28T00:06:56Z")

</div>

> [@mac5562](#):
>
> My devices, which running on batteries every 3 minutes send message

Can I assume these devices are sensors of some type. Doing an insert every three minutes shouldn’t be a problem. Does the laptop ever go to sleep or go into a reduced power mode?

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [28 February 2021 01:25 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/7 "2021-02-28T01:25:26Z")

</div>

No. I disabled that reason.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [28 February 2021 01:48 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/8 "2021-02-28T01:48:34Z")

</div>

Why are you using separate nodes for the insert and select?

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [28 February 2021 09:16 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/9 "2021-02-28T09:16:51Z")

</div>

I noticed that, if i use the same node for the select and the insert it cause some trouble.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 February 2021 09:23 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/10 "2021-02-28T09:23:44Z")

</div>

Whatever the cause of the error, it should not crash node-red, I think that in itself shows that there is a problem in node-red-node-mysql as it is not catching the error correctly.

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [28 February 2021 09:37 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/11 "2021-02-28T09:37:29Z")

</div>

Yeah, i think that too. Do you know any alternative mysql node ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 February 2021 09:54 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/12 "2021-02-28T09:54:43Z")

</div>

No, but that node is maintained by the core developers, so it may well receive attention quite quickly. I suggest submitting an issue [here](https://github.com/node-red/node-red-nodes/issues).

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [28 February 2021 10:02 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/13 "2021-02-28T10:02:17Z")

</div>

> [@mac5562](#):
>
> I noticed that, if i use the same node for the select and the insert it cause some trouble.

what kind of trouble?

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [28 February 2021 10:06 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/14 "2021-02-28T10:06:58Z")

</div>

When i send a insert query to node, from the node output got a object. which i don't need and the handle is cumbersome.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [28 February 2021 11:22 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/15 "2021-02-28T11:22:35Z")

</div>

What do you mean it is cumbersome

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 February 2021 16:06 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/16 "2021-02-28T16:06:52Z")

</div>

> [@Colin](#):
>
> t may well receive attention quite quickly

by all means raise it as an issue so we have it logged and tracked, - but as a) we don't use it regularly, b) the crash only seems to occur occasionally, c) no use case to demonstrate the error d) the error listed looks to be in the underlying library, and e) databases are not my area of expertise - I'm going to say that it may sit there a long time unless someone else is prepared to step up and help.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 February 2021 17:57 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/17 "2021-02-28T17:57:58Z")

</div>

Should not every call into the library be surrounded by try, catch? Or is it not that simple with async functions?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 February 2021 18:42 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/18 "2021-02-28T18:42:36Z")

</div>

indeed - not when they are thrown asynchronously.

---

<div class="post-metadata">

**Author:** ![mac5562](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mac5562/32/34943_2.png) [@mac5562](https://discourse.nodered.org/u/mac5562)\
**Post date:** [28 February 2021 19:02 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/19 "2021-02-28T19:02:20Z")

</div>

Elarobate if it's more understandable. Handling what we got from the mysql node when i insert i found dificult so i simple use separate nodes for both inserts and the selects.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 April 2021 19:02 UTC](https://discourse.nodered.org/t/uncaught-exception-from-mysql-nodes/41732/20 "2021-04-29T19:02:28Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
