[ 
https://issues.apache.org/jira/browse/IGNITE-14550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18086691#comment-18086691
 ] 

Frank Beutelschiess commented on IGNITE-14550:
----------------------------------------------

We hit this in production with {{[email protected]}} under concurrent 
scan/SQL load (>10 q/s). Root cause: {{ClientSocket._processResponse}} is 
{{async}} and {{{}await{}}}s the payload reader while still holding shared 
{{{}this._buffer{}}}/{{{}this._offset{}}} state; since Node doesn't await async 
{{data}} listeners, a second frame re-enters {{_processResponse}} mid-await and 
corrupts the shared buffer → bogus request id → throw → disconnect.

Stable workaround for us: split {{_processResponse}} into a *synchronous 
framing phase* (copy each complete message into its own isolated buffer slice, 
no {{{}await{}}}) followed by an *async dispatch phase* on those slices.

For anyone stuck on the only npm release (1.0.0), we published a small, 
dependency-free, Apache-2.0 drop-in runtime patch (just {{require()}} it before 
the client): 
{{https://www.npmjs.com/package/@frankbearguard/ignite-client-14550-fix}} · 
repo {{{}https://github.com/FrankKanBear/ignite-client-14550-fix{}}}. 
Unofficial community fix, as-is. A fuller source-level fix also exists in PR 
#10.

> NodeJS Thin Client: Invalid response id: in ClientSocket.js
> -----------------------------------------------------------
>
>                 Key: IGNITE-14550
>                 URL: https://issues.apache.org/jira/browse/IGNITE-14550
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 1.9
>            Reporter: Dheeraj Saini
>            Priority: Blocker
>         Attachments: image-2021-04-15-18-40-32-507.png
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Hi Team,
>  
> We are using NodeJS Thin client to connect with ignite node. When we run 
> single query to get data from ignite we are able to get data but when we try 
> to get 10 query per sec we getting below error random times.
>  
> debug - Error: Invalid response id: 4122254909997320969    at 
> /webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:344:28 
>    at Map.forEach (<anonymous>)    at ClientSocket._disconnect 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:343:24)
>     at Socket.<anonymous> 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:170:22)
>     at runMicrotasks (<anonymous>)    at processTicksAndRejections 
> (internal/process/task_queues.js:97:5)[2021-04-15T04:28:51.812] [INFO] debug 
> - Error: Invalid response id: 4122254909997320969    at 
> /webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:344:28 
>    at Map.forEach (<anonymous>)    at ClientSocket._disconnect 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:343:24)
>     at Socket.<anonymous> 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:170:22)
>     at runMicrotasks (<anonymous>)    at processTicksAndRejections 
> (internal/process/task_queues.js:97:5)[2021-04-15T04:28:51.812] [INFO] debug 
> - Error: Invalid response id: 4122254909997320969    at 
> /webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:344:28 
>    at Map.forEach (<anonymous>)    at ClientSocket._disconnect 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:343:24)
>     at Socket.<anonymous> 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientSocket.js:170:22)
>     at runMicrotasks (<anonymous>)    at processTicksAndRejections 
> (internal/process/task_queues.js:97:5)[2021-04-15T04:28:51.813] [INFO] debug 
> - Error: Type type code 0 is not supported    at 
> Function.unsupportedTypeError 
> (/webapp/node_modules/apache-ignite-client/lib/Errors.js:36:16)    at 
> BinaryCommunicator._readTypedObject 
> (/webapp/node_modules/apache-ignite-client/lib/internal/BinaryCommunicator.js:216:48)
>     at BinaryCommunicator.readObject 
> (/webapp/node_modules/apache-ignite-client/lib/internal/BinaryCommunicator.js:66:27)
>     at SqlFieldsCursor._readRow 
> (/webapp/node_modules/apache-ignite-client/lib/Cursor.js:300:50)    at 
> runMicrotasks (<anonymous>)    at processTicksAndRejections 
> (internal/process/task_queues.js:97:5)    at async SqlFieldsCursor._read 
> (/webapp/node_modules/apache-ignite-client/lib/Cursor.js:187:31)    at async 
> SqlFieldsCursor._getValues 
> (/webapp/node_modules/apache-ignite-client/lib/Cursor.js:151:9)    at async 
> SqlFieldsCursor.getValue 
> (/webapp/node_modules/apache-ignite-client/lib/Cursor.js:47:13)    at async 
> SqlFieldsCursor.getValue 
> (/webapp/node_modules/apache-ignite-client/lib/Cursor.js:217:16)    at async 
> Function.igniteDatabase.getdata (/webapp/ignite.js:211:20)    at async filter 
> (/webapp/htpl/search.js:630:25)[2021-04-15T04:28:51.940] [INFO] debug - 
> Error: Ignite client is not in an appropriate state for the requested 
> operation    at ClientFailoverSocket.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientFailoverSocket.js:47:19)
>     at BinaryCommunicator.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/BinaryCommunicator.js:56:28)
>     at CacheClient.query 
> (/webapp/node_modules/apache-ignite-client/lib/CacheClient.js:538:34)    at 
> Function.igniteDatabase.getdata (/webapp/ignite.js:206:48)    at filter 
> (/webapp/htpl/search.js:630:46)    at runMicrotasks (<anonymous>)    at 
> processTicksAndRejections 
> (internal/process/task_queues.js:97:5)[2021-04-15T04:28:51.941] [INFO] debug 
> - Error: Ignite client is not in an appropriate state for the requested 
> operation    at ClientFailoverSocket.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientFailoverSocket.js:47:19)
>     at BinaryCommunicator.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/BinaryCommunicator.js:56:28)
>     at CacheClient.query 
> (/webapp/node_modules/apache-ignite-client/lib/CacheClient.js:538:34)    at 
> Function.igniteDatabase.getdata (/webapp/ignite.js:206:48)    at filter 
> (/webapp/htpl/search.js:630:46)    at runMicrotasks (<anonymous>)    at 
> processTicksAndRejections 
> (internal/process/task_queues.js:97:5)[2021-04-15T04:28:51.941] [INFO] debug 
> - Error: Ignite client is not in an appropriate state for the requested 
> operation    at ClientFailoverSocket.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientFailoverSocket.js:47:19)
>     at BinaryCommunicator.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/BinaryCommunicator.js:56:28)
>     at CacheClient.query 
> (/webapp/node_modules/apache-ignite-client/lib/CacheClient.js:538:34)    at 
> Function.igniteDatabase.getdata (/webapp/ignite.js:206:48)    at filter 
> (/webapp/htpl/search.js:630:46)    at runMicrotasks (<anonymous>)    at 
> processTicksAndRejections 
> (internal/process/task_queues.js:97:5)[2021-04-15T04:28:51.942] [INFO] debug 
> - Error: Ignite client is not in an appropriate state for the requested 
> operation    at ClientFailoverSocket.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/ClientFailoverSocket.js:47:19)
>     at BinaryCommunicator.send 
> (/webapp/node_modules/apache-ignite-client/lib/internal/BinaryCommunicator.js:56:28)
>     at CacheClient.query 
> (/webapp/node_modules/apache-ignite-client/lib/CacheClient.js:538:34)    at 
> Function.igniteDatabase.getdata (/webapp/ignite.js:206:48)    at filter 
> (/webapp/htpl/search.js:630:46)    at runMicrotasks (<anonymous>)    at 
> processTicksAndRejections (internal/process/task_queues.js:97:5)
>  
>  
> Apache Ignite Version: 2.9.1
> NodeJS Client "apache-ignite-client": "^1.0.0"
>  
> I have put console in lib/internal/ClientSocket.js and try to debug code. 
> Observation is whenever we send any request to socket we create a request Id 
> and store into map. When response comes back from socket, we fetch request id 
> from response and process further. But in many case request id from socket 
> response not matching in our request id map. Due to this we getting this 
> error.
>  
>  Source Code snippets of ClientSocket.js
>  
> !image-2021-04-15-18-40-32-507.png!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to