Commit ce2ad75
authored
fix: resolve parser cache collision with dual typeCast connections (#3644)
* fix: resolve parser cache collision with dual typeCast connections
The parser cache system had a bug where connections with different
typeCast boolean values (true vs false) would share cached parsers,
causing incorrect data type conversion.
Update `parser_cache.js` with following changes :
- Enhanced cache key generation to create unique keys for each typeCast value
- Now typeCast: true and typeCast: false generate distinct cache keys
- Maintains function-based typeCast compatibility
- Ensures proper cache isolation and eliminates ambiguous cache hits
Add test to validate changes in `test-typecast-dual-connections.test.cjs`
with following changes :
- Added test-typecast-dual-connections.test.cjs to validate the fix
- Tests concurrent connections with different typeCast boolean settings
- Prevents future regressions in parser cache logic
Signed-off-by: Mohit Malhotra <[email protected]>
* enh: update parser key generation condition for typecast and tests to match parser cache behavior
Update test expectations for `typeCast` field to reflect actual implementation
where `typeCast` returns the value directly instead of the type.
This aligns tests with the `lib/parsers/parser_cache.js` key generation logic.
Add more robust check for generating key for parser caching for the field `tyepCast`
to ensure value is used for only boolean input. Also removed `test-typecast-dual-connections.test.cjs`
as existing testcases are sufficient.
Signed-off-by: Mohit Malhotra <[email protected]>
---------
Signed-off-by: Mohit Malhotra <[email protected]>1 parent 4e395ea commit ce2ad75
File tree
2 files changed
+67
-9
lines changed- lib/parsers
- test/esm/unit/parsers
2 files changed
+67
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
329 | 369 | | |
330 | 370 | | |
331 | 371 | | |
| |||
380 | 420 | | |
381 | 421 | | |
382 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
383 | 429 | | |
384 | 430 | | |
385 | 431 | | |
| |||
395 | 441 | | |
396 | 442 | | |
397 | 443 | | |
398 | | - | |
| 444 | + | |
399 | 445 | | |
400 | 446 | | |
401 | 447 | | |
402 | 448 | | |
403 | 449 | | |
404 | | - | |
| 450 | + | |
405 | 451 | | |
406 | 452 | | |
407 | 453 | | |
| |||
410 | 456 | | |
411 | 457 | | |
412 | 458 | | |
413 | | - | |
| 459 | + | |
414 | 460 | | |
415 | 461 | | |
416 | 462 | | |
417 | 463 | | |
418 | 464 | | |
419 | 465 | | |
420 | | - | |
| 466 | + | |
421 | 467 | | |
422 | 468 | | |
423 | 469 | | |
| |||
433 | 479 | | |
434 | 480 | | |
435 | 481 | | |
436 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
437 | 489 | | |
438 | 490 | | |
439 | 491 | | |
| |||
455 | 507 | | |
456 | 508 | | |
457 | 509 | | |
| 510 | + | |
| 511 | + | |
458 | 512 | | |
459 | | - | |
| 513 | + | |
460 | 514 | | |
461 | 515 | | |
462 | 516 | | |
| |||
465 | 519 | | |
466 | 520 | | |
467 | 521 | | |
468 | | - | |
| 522 | + | |
469 | 523 | | |
470 | 524 | | |
471 | 525 | | |
| |||
487 | 541 | | |
488 | 542 | | |
489 | 543 | | |
| 544 | + | |
| 545 | + | |
490 | 546 | | |
491 | | - | |
| 547 | + | |
492 | 548 | | |
0 commit comments