I've read Multi threaded access requested by thread Thread[pool-2-thread-1,5,main] but is not allowed for language(s) js and Karate - Multi threaded access requested - issue (which says this was fixed in karate 1.1.0.RC2. I'm using karate 1.5.1 and am getting this error traced to the following line:
* call read('classpath:lib/NuxeoClient.feature@AddDocVersion') {docId: '#(baseCntntIdNum)', filePath: '#(testFiles.testv2pdf.path)'}
I'd like to find the offending javascript, so I can try to remove/replace it and be able to run multi-threaded successfully. But, I'm not sure how to find the offending javascript. The above called Scenario doesn't call any js functions.
It does include a line like this:
* def iso8601String = instant.replace(/...Z$/, 'Z')
and it does call other features that have lines like these:
* if ( __arg.filePath ) karate.call('classpath:lib/NuxeoClient.feature@UploadFileToBatch', {filePath: __arg.filePath})
and
* def fullQuery = __arg.version ? baseQuery + " AND base:version_id = " + __arg.version : baseQuery + "ORDER BY base:version_id DESC"
Do any of these constitute javascript that would cause the multi-threaded processing to fail?
Yes, unfortunately read()
could be problem and I think replace()
also, these are JS function calls which are the most troublesome. And if they call other features, the surface area increases etc.
I suggest a step by step approach where you can remove pieces of code and see what works. FYI, we have a long term fix for this, it should land by mid-2025: https://github.com/karatelabs/karate-js