Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
1.5.8
I am making the same call to a store procedure multiple times with very little change in the arguments. The first call succeeds but the second call creates a null pointer exception.
The problem is caused at line 487 of MariaDbConnection class. That is when the callableStatementCache is adding a new callableStatement. That callableStatement has a the sql field populated but the value for the items that is added to the callableStatementCache has null sql field. When that value is fetched on line 479 the clone fails with a NullPointerException because the sql field cannot be null.
Below is the stack trace.
java.lang.NullPointerException
at org.mariadb.jdbc.MariaDbServerPreparedStatement.prepare(MariaDbServerPreparedStatement.java:143) at org.mariadb.jdbc.MariaDbServerPreparedStatement.clone(MariaDbServerPreparedStatement.java:134) at org.mariadb.jdbc.AbstractCallableProcedureStatement.clone(AbstractCallableProcedureStatement.java:99) at org.mariadb.jdbc.MariaDbProcedureStatement.clone(MariaDbProcedureStatement.java:119) at org.mariadb.jdbc.MariaDbProcedureStatement.clone(MariaDbProcedureStatement.java:62) at org.mariadb.jdbc.MariaDbConnection.prepareCall(MariaDbConnection.java:479) at com.zaxxer.hikari.pool.ProxyConnection.prepareCall(ProxyConnection.java:289) at com.zaxxer.hikari.pool.HikariProxyConnection.prepareCall(HikariProxyConnection.java)
{"report":{"fcp":895.0999999046326,"ttfb":221.69999992847443,"pageVisibility":"visible","entityId":60514,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"238d3102-4c5d-42dd-9e9b-4106ad9e77f0","navigationType":0,"readyForUser":969.8999999761581,"redirectCount":0,"resourceLoadedEnd":601.1999999284744,"resourceLoadedStart":229.29999995231628,"resourceTiming":[{"duration":86.10000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":229.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":229.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":315.39999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":86.19999992847443,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":229.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":229.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":315.6999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":256.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":229.69999992847443,"connectEnd":229.69999992847443,"connectStart":229.69999992847443,"domainLookupEnd":229.69999992847443,"domainLookupStart":229.69999992847443,"fetchStart":229.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":317.1999999284744,"responseEnd":486.39999997615814,"responseStart":329.1999999284744,"secureConnectionStart":229.69999992847443},{"duration":371.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":229.89999997615814,"connectEnd":229.89999997615814,"connectStart":229.89999997615814,"domainLookupEnd":229.89999997615814,"domainLookupStart":229.89999997615814,"fetchStart":229.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":318.2999999523163,"responseEnd":601.1999999284744,"responseStart":341.1999999284744,"secureConnectionStart":229.89999997615814},{"duration":101.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":230,"connectEnd":230,"connectStart":230,"domainLookupEnd":230,"domainLookupStart":230,"fetchStart":230,"redirectEnd":0,"redirectStart":0,"requestStart":318.7999999523163,"responseEnd":331.7999999523163,"responseStart":331,"secureConnectionStart":230},{"duration":113.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":230.19999992847443,"connectEnd":230.19999992847443,"connectStart":230.19999992847443,"domainLookupEnd":230.19999992847443,"domainLookupStart":230.19999992847443,"fetchStart":230.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":320.5,"responseEnd":343.6999999284744,"responseStart":342.6999999284744,"secureConnectionStart":230.19999992847443},{"duration":115.69999992847443,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":230.39999997615814,"connectEnd":230.39999997615814,"connectStart":230.39999997615814,"domainLookupEnd":230.39999997615814,"domainLookupStart":230.39999997615814,"fetchStart":230.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":322.09999990463257,"responseEnd":346.09999990463257,"responseStart":343.89999997615814,"secureConnectionStart":230.39999997615814},{"duration":89.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":230.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":230.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":320,"responseStart":0,"secureConnectionStart":0},{"duration":115.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":230.79999995231628,"connectEnd":230.79999995231628,"connectStart":230.79999995231628,"domainLookupEnd":230.79999995231628,"domainLookupStart":230.79999995231628,"fetchStart":230.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":322.5,"responseEnd":346.39999997615814,"responseStart":344.59999990463257,"secureConnectionStart":230.79999995231628},{"duration":90.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":231,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":231,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":321.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":120.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":231.19999992847443,"connectEnd":231.19999992847443,"connectStart":231.19999992847443,"domainLookupEnd":231.19999992847443,"domainLookupStart":231.19999992847443,"fetchStart":231.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":323.89999997615814,"responseEnd":351.39999997615814,"responseStart":345.1999999284744,"secureConnectionStart":231.19999992847443},{"duration":355.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":234.19999992847443,"connectEnd":234.19999992847443,"connectStart":234.19999992847443,"domainLookupEnd":234.19999992847443,"domainLookupStart":234.19999992847443,"fetchStart":234.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":410,"responseEnd":589.2999999523163,"responseStart":583,"secureConnectionStart":234.19999992847443},{"duration":358.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":234.29999995231628,"connectEnd":234.29999995231628,"connectStart":234.29999995231628,"domainLookupEnd":234.29999995231628,"domainLookupStart":234.29999995231628,"fetchStart":234.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":440,"responseEnd":592.3999999761581,"responseStart":585.0999999046326,"secureConnectionStart":234.29999995231628},{"duration":169,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":637.7999999523163,"connectEnd":637.7999999523163,"connectStart":637.7999999523163,"domainLookupEnd":637.7999999523163,"domainLookupStart":637.7999999523163,"fetchStart":637.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":773,"responseEnd":806.7999999523163,"responseStart":806.1999999284744,"secureConnectionStart":637.7999999523163}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":66,"responseStart":222,"responseEnd":233,"domLoading":225,"domInteractive":1071,"domContentLoadedEventStart":1071,"domContentLoadedEventEnd":1117,"domComplete":1583,"loadEventStart":1584,"loadEventEnd":1584,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1046.5},{"name":"bigPipe.sidebar-id.end","time":1047.3999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":1047.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1048.8999999761581},{"name":"activityTabFullyLoaded","time":1142.5999999046326}],"measures":[],"correlationId":"f92ca83458aba5","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":10,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The only NPE that can be thrown here is if `protocol` is null.
And AFAIK this can only happen if the statement has been closed.
serverPrepareResult = protocol.prepare(sql, mustExecuteOnMaster);