[CONJS-211] Session timezone unset on connection re-use with connection pool Created: 2022-08-05 Updated: 2023-05-25 Resolved: 2022-09-20 |
|
| Status: | Closed |
| Project: | MariaDB Connector/node.js |
| Component/s: | pool |
| Affects Version/s: | 2.5.5 |
| Fix Version/s: | 3.0.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lincoln McCormick | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Node 14.19.3 |
||
| Description |
|
We are finding dates sporadically double-converted between time zones when using the connection pool, producing a wrong date (even when rendered as epoch time). Test code appears to show that session time zone reverts to SYSTEM after the first use of each connection in the pool. Sample code is as follows:
Results are non-deterministic, but this is typical: Connection 1 TZ: +00:00 Connection 2 TZ: SYSTEM Connection 3 TZ: SYSTEM Connection 4 TZ: SYSTEM Connection 5 TZ: +00:00 The first use of connection ID 264 correctly reports UTC in @@time_zone, and reads the correct time from SYSDATE(). The next three uses of 264 incorrectly see SYSTEM in @@time_zone and show the wrong time when decoding SYSDATE() - specifically, the time appears to have been double-converted from UTC to EDT. 0146 EDT is correct, but subsequent uses of the connection apparently see 0146 UTC and then convert that to 2146 EDT on the previous day. Removing the comment on the await new Promise line creates a two-second delay before the connection is returned to the pool, forcing the next request to use a new connection. In this case all five requests report the correct time and time zone. However, if we then keep the connection pool at 5 and perform 10 requests instead, we get the same problem: Connection 1 TZ: +00:00 Connection 2 TZ: +00:00 Connection 3 TZ: +00:00 Connection 4 TZ: +00:00 Connection 5 TZ: +00:00 Connection 6 TZ: SYSTEM Connection 7 TZ: SYSTEM Connection 8 TZ: SYSTEM Connection 9 TZ: SYSTEM Connection 10 TZ: SYSTEM |
| Comments |
| Comment by Diego Dupin [ 2022-08-17 ] |
|
Problem reside that giving back connection to pool use reset command. initial command like setting timezone must be handle when reset is executed. (reset is default bahaviour in 2.x, not in 3.x) |