[MDEV-21859] FUNCTION xxx does not exist error when stored procedure cache limit is reached Created: 2020-03-02 Updated: 2023-04-27 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Stored routines |
| Affects Version/s: | 10.0, 10.1, 10.1.44, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Joe Branton | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian Stretch on AMD64 and ARM64 |
||
| Attachments: |
|
| Description |
|
We have a system that makes extensive use of stored routines. For some time we have seen occasional sqlState 42000 "FUNCTION <function-name> does not exist" exceptions on our production servers. It look a while to figure out a set of use cases that reliably reproduced the problem. However, we have now done that and it appears that the point at which the number of entries in the sp cache exceeds the 'stored_program_cache' configuration value (which we had set to the default of 256), subsequent CALL operations on the connection in question fail with "FUNCTION <function-name> does not exist". This situation remains until either the connection is closed and reopened or something causes the sp cache "version" to be incremented. For the time being we will simply increase the value of 'stored_program_cache' to avoid hitting the limit. However, presumably the server should continue to operate as normal in the event where the cache limit is reached. |
| Comments |
| Comment by Elena Stepanova [ 2020-03-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Couldn't reproduce it (since it's unclear from the description whether it is about functions or procedures – the error suggests functions, while the CALL reference suggests procedures – the test case does both. Couldn't reproduce it separately either):
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joe Branton [ 2020-03-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Elena, Thanks for your efforts to try to reproduce this and apologies that my description wasn't clearer. In our situation we are always calling procedures. It appears to be a function that one of these procedures uses that is erroneously reported as missing. Inspired by your approach to attempting to reproduce the issue, I wrote something similar that shows the problem. I used the attached perl script ('tsp_cache.pl') to generate the attached SQL file ('tsp_cache.sql'). When the latter is run, I see the following output: Calling p1 ... Most of the above output relates to arranging for the sp cache to contain 256 function entries (via a call to "InflateSpCache". After this, the function 'f257' is called via a select. This causes the number of function entries in the sp cache to get to 257 and as a result for the cache to be reset. Then a subsequent attempt to call the procedure 'p1' fails with the claim that the function 'test.f1' does not exist, which isn't the case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2020-03-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks! I repeated the problem on 10.0-10.5. on 5.5 there is " query 'call p1()' failed: 1436: Thread stack overrun: 174496 bytes used of a 294912 byte stack, and 128000 bytes needed. "
|