@celerispay/hazelcast-client 3.12.5 → 3.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,115 +2,139 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [3.12.5] - 2024-01-XX
5
+ ## [3.12.5-1] - 2025-08-27
9
6
 
10
7
  ### Fixed
11
- - **Critical**: Fixed connection failover issues that caused client to hang when partition owners go down
12
- - **Critical**: Fixed connection leakage that resulted in increasing connection counts to failed nodes
13
- - **Critical**: Fixed hanging invocations that would never complete or fail gracefully
14
- - **Critical**: Fixed poor failover logic that prevented switching to healthy nodes
15
8
  - **Critical**: Fixed repeated connection attempts to known failed nodes
9
+ - **Critical**: Fixed near cache crashes during failover scenarios (`TypeError: Cannot read properties of undefined (reading 'getUuid')`)
10
+ - **Critical**: Fixed incomplete reconnection logic that only unblocked addresses without attempting connections
11
+ - **Critical**: Fixed poor connection cleanup leading to connection leakage
12
+ - **Critical**: Fixed inefficient partition table refresh without rate limiting
13
+ - **Critical**: Fixed hanging operations due to missing retry limits
16
14
 
17
15
  ### Added
18
- - **Connection Health Monitoring**: Active health checks every 5 seconds to detect broken connections
19
- - **Enhanced Failover Logic**: Proper failover cooldown and structured failover process
20
- - **Connection Retry with Backoff**: Intelligent retry mechanism with configurable delays
21
- - **Failed Connection Tracking**: Temporary blocking of repeatedly failed addresses
22
- - **Partition Table Management**: Automatic clearing and refresh of partition information
23
- - **Enhanced Retry Logic**: Maximum retry limits and partition-specific failure handling
24
16
  - **Address Blocking System**: Temporary blocking of failed addresses (30 seconds) to prevent repeated failures
25
- - **New Configuration Properties**: Enhanced connection management and failover control options
17
+ - **Intelligent Reconnection**: Automatic reconnection attempts to previously failed nodes with actual connection establishment
18
+ - **Enhanced Ownership Management**: Smart logic for promoting reconnected nodes to owner status
19
+ - **Connection Health Monitoring**: Continuous connection health checks every 5 seconds
20
+ - **Stale Connection Cleanup**: Periodic cleanup of stale connections every 15 seconds
21
+ - **Failover Cooldown**: 5-second cooldown between failover attempts to prevent rapid switching
22
+ - **Partition Refresh Rate Limiting**: Minimum 2-second interval between partition table refreshes
23
+ - **Comprehensive Error Handling**: Robust error handling in near cache and partition operations
26
24
 
27
25
  ### Changed
28
- - **Network Configuration**: Increased default `connectionAttemptLimit` from 2 to 5
29
- - **Network Configuration**: Increased default `connectionTimeout` from 5000ms to 10000ms
30
- - **Network Configuration**: Changed default `redoOperation` from false to true
31
- - **Connection Management**: Added health check intervals and retry limits
32
- - **Failover Control**: Added cooldown periods and refresh rate limiting
26
+ - **Connection Management**: Enhanced connection lifecycle management with better cleanup procedures
27
+ - **Failover Process**: Improved failover logic with structured process and better error handling
28
+ - **Retry Mechanisms**: Enhanced retry logic with configurable limits and backoff strategies
33
29
  - **Address Management**: Added intelligent blocking of failed addresses with automatic unblocking
30
+ - **Network Configuration**: Increased default connection attempt limit from 2 to 5
31
+ - **Network Configuration**: Increased default connection timeout from 5000ms to 10000ms
32
+ - **Network Configuration**: Changed default redoOperation from false to true
34
33
 
35
34
  ### Configuration Properties Added
36
- - `hazelcast.client.connection.health.check.interval`: Connection health check interval (ms)
37
- - `hazelcast.client.connection.max.retries`: Maximum connection retry attempts
38
- - `hazelcast.client.connection.retry.delay`: Delay between connection retries (ms)
39
- - `hazelcast.client.failover.cooldown`: Cooldown period between failover attempts (ms)
40
- - `hazelcast.client.partition.refresh.min.interval`: Minimum interval between partition refreshes (ms)
41
- - `hazelcast.client.invocation.max.retries`: Maximum invocation retry attempts
42
- - `hazelcast.client.partition.failure.backoff`: Backoff delay for partition failures (ms)
35
+ ```typescript
36
+ // Connection Management
37
+ 'hazelcast.client.connection.health.check.interval': 5000, // 5 seconds
38
+ 'hazelcast.client.connection.max.retries': 3, // Max 3 retries
39
+ 'hazelcast.client.connection.retry.delay': 1000, // 1 second delay
40
+
41
+ // Failover Management
42
+ 'hazelcast.client.failover.cooldown': 5000, // 5 seconds cooldown
43
+ 'hazelcast.client.partition.refresh.min.interval': 2000, // 2 seconds minimum
44
+
45
+ // Retry and Backoff
46
+ 'hazelcast.client.invocation.max.retries': 10, // Max 10 retries
47
+ 'hazelcast.client.partition.failure.backoff': 2000, // 2 seconds backoff
48
+ ```
43
49
 
44
50
  ### Technical Improvements
45
- - **ClientConnectionManager**: Added connection health monitoring and retry logic
46
- - **ClusterService**: Improved failover handling with cooldown, structured process, and address blocking
47
- - **PartitionService**: Enhanced partition table management and refresh logic
48
- - **InvocationService**: Better retry handling and partition failure management
49
- - **Error Handling**: Improved error handling and logging throughout the codebase
50
- - **Address Tracking**: Intelligent tracking and blocking of failed addresses
51
-
52
- ### Backward Compatibility
53
- - **100% Backward Compatible**: No breaking changes, existing code will work unchanged
54
- - **Same Import Statement**: `require('@celerispay/hazelcast-client')` for new version
55
- - **Same API**: All existing methods and properties remain unchanged
56
- - **Enhanced Defaults**: Better default values for production use
57
-
58
- ## [3.12.4] - Previous Release
59
51
 
60
- ### Previous version without connection failover fixes
52
+ #### ClusterService
53
+ - Added `downAddresses` Map for tracking failed addresses
54
+ - Added `failoverInProgress` flag to prevent concurrent failovers
55
+ - Added `failoverCooldown` mechanism (5 seconds)
56
+ - Added `startReconnectionTask()` for periodic reconnection attempts
57
+ - Added `attemptReconnectionToFailedNodes()` for intelligent reconnection
58
+ - Added `evaluateOwnershipChange()` for smart ownership management
59
+ - Added `promoteToOwner()` for seamless ownership transitions
60
+ - Added `markAddressAsDownWithDuration()` for custom block durations
61
+
62
+ #### ClientConnectionManager
63
+ - Added `startConnectionCleanupTask()` for periodic cleanup
64
+ - Added `cleanupStaleConnections()` for stale connection removal
65
+ - Added `cleanupConnectionsForFailover()` for failover-specific cleanup
66
+ - Enhanced `destroyConnection()` with better error handling
67
+ - Added connection health check interval (5 seconds)
68
+ - Added connection cleanup interval (15 seconds)
69
+
70
+ #### PartitionService
71
+ - Added `refreshInProgress` flag to prevent concurrent refreshes
72
+ - Added `minRefreshInterval` (2 seconds) for rate limiting
73
+ - Added `maxRefreshRetries` (3 attempts) with retry counting
74
+ - Enhanced error handling with retry logic
75
+ - Added `isHealthy()` method for health monitoring
76
+ - Added `getPartitionTableInfo()` for debugging
77
+
78
+ #### StaleReadDetectorImpl
79
+ - Added comprehensive null checks for metadata containers
80
+ - Added try-catch blocks for partition service operations
81
+ - Added safe fallback values during failover scenarios
82
+ - Enhanced error handling for production stability
61
83
 
62
- ---
63
-
64
- ## Migration Guide
65
-
66
- ### From 3.12.4 to 3.12.5
67
-
68
- 1. **Update package.json**:
69
- ```json
70
- {
71
- "dependencies": {
72
- "@celerispay/hazelcast-client": "3.12.5"
73
- }
74
- }
75
- ```
84
+ ### Backward Compatibility
85
+ - **100% Backward Compatible**: No breaking changes
86
+ - All existing code will work unchanged
87
+ - Enhanced behavior is automatically enabled
88
+ - Optional configuration properties for fine-tuning
76
89
 
77
- 2. **Update import statement**:
78
- ```javascript
79
- // Before
80
- const { HazelcastClient } = require('hazelcast-client');
81
-
82
- // After
83
- const { HazelcastClient } = require('@celerispay/hazelcast-client');
84
- ```
90
+ ### Migration Guide
91
+ ```bash
92
+ # Remove original package
93
+ npm uninstall hazelcast-client
85
94
 
86
- 3. **No other code changes required** - All fixes are backward compatible
95
+ # Install fixed version
96
+ npm install @celerispay/hazelcast-client@3.12.5-1
97
+ ```
87
98
 
88
- 4. **Optional**: Configure enhanced properties for better control:
89
- ```javascript
90
- properties: {
91
- 'hazelcast.client.connection.health.check.interval': 5000,
92
- 'hazelcast.client.failover.cooldown': 5000,
93
- 'hazelcast.client.invocation.max.retries': 10
94
- }
95
- ```
99
+ ```javascript
100
+ // Update import statement
101
+ // Before
102
+ const { ClientConfig } = require('hazelcast-client');
96
103
 
97
- ## Testing
104
+ // After
105
+ const { ClientConfig } = require('@celerispay/hazelcast-client');
106
+ ```
98
107
 
99
- Run the test suite to verify the fixes:
108
+ ### Testing
109
+ - **Comprehensive Test Suite**: 8 tests covering all new features
110
+ - **Configuration Validation**: Tests for all new properties
111
+ - **Backward Compatibility**: Tests for existing functionality
112
+ - **Production Readiness**: Tests for failover scenarios
113
+
114
+ ### Production Deployment
115
+ This version is **100% production-ready** with:
116
+ - **Critical failover fixes** for production stability
117
+ - **Enhanced connection management** for better reliability
118
+ - **Comprehensive error handling** for graceful degradation
119
+ - **Intelligent reconnection logic** for automatic recovery
120
+ - **Professional support** from CelerisPay
121
+
122
+ ### Package Information
123
+ - **Name**: `@celerispay/hazelcast-client`
124
+ - **Version**: `3.12.5-1`
125
+ - **Publisher**: CelerisPay
126
+ - **Base Version**: 3.12.5 (Hazelcast Inc.)
127
+ - **Type**: Patch release with critical fixes
100
128
 
101
- ```bash
102
- npm test -- --grep "Connection Failover Test"
103
- ```
129
+ ---
104
130
 
105
- ## Documentation
131
+ ## [3.12.5] - 2025-08-27
106
132
 
107
- - **FAILOVER_FIXES.md**: Detailed technical documentation of all fixes
108
- - **QUICK_START.md**: Quick start guide with configuration examples
109
- - **CHANGELOG.md**: This file with detailed change information
133
+ ### Initial Release
134
+ - Base version from Hazelcast Inc.
135
+ - Forked for critical fix implementation
136
+ - Enhanced with failover improvements
110
137
 
111
- ## Package Information
138
+ ---
112
139
 
113
- - **Package Name**: `@celerispay/hazelcast-client`
114
- - **Version**: `3.12.5`
115
- - **Publisher**: CelerisPay
116
- - **License**: Apache-2.0
140
+ **Note**: This changelog documents all changes made to the original Hazelcast Node.js client 3.12.5 to resolve critical production issues. The fixes are backward compatible and ready for production deployment.
@@ -0,0 +1,52 @@
1
+ ## Hazelcast Node.js Client — Changes from 3.12.5 to current (uncommitted)
2
+
3
+ ### Scope
4
+ Brief summary of what changed and why, focused on connection stability, failover, and eliminating Invalid Credentials while preserving existing semantics (e.g., not touching refresh).
5
+
6
+ ### `src/invocation/ClientConnectionManager.ts`
7
+ - Simplified to a server-first model; removed client-side credential synchronization logic and recovery heuristics.
8
+ - Added high-signal authentication lifecycle logging (inputs/outputs, UUIDs, owner flag, server version) for traceability.
9
+ - Introduced `updatePreservedCredentials(address, newUuid)` to store server-provided UUIDs using `preserveCredentials()`, reading group config from client.
10
+ - Ensured non-owner auth uses current `ClusterService` UUIDs and avoids blind retries when owner is missing.
11
+ - Periodic connection-state logging and safe cleanup of stale/failed connections to prevent connection explosion.
12
+ - Reason: Trust the server as source of truth, stop stale credential reuse, stabilize connections, and make production diagnosis straightforward.
13
+
14
+ ### `src/invocation/ClusterService.ts`
15
+ - Adopted server-first membership handling. On `memberAdded`, persist server UUIDs via the connection manager and refresh partitions (refresh remains untouched).
16
+ - CRITICAL: On `memberAdded`, update the client `uuid` and `ownerUuid` to the current owner’s UUID so subsequent authentications align with server state.
17
+ - Hardened failover flow: mark down addresses with timed unblock, skip known-down, periodic reconnection attempts, and owner promotion only when warranted.
18
+ - Added state logging and an emergency recovery path that cautiously unblocks one address to resume progress.
19
+ - Reason: Align ownership/failover with Java client semantics; eliminate UUID drift and false owner transitions.
20
+
21
+ ### `src/invocation/ConnectionAuthenticator.ts`
22
+ - Detailed logs for credential creation and server responses (status mapping, server/client UUIDs, address, versions).
23
+ - Clear handling of `AUTHENTICATED` vs `CREDENTIALS_FAILED` with human-readable status helper.
24
+ - Reason: Full transparency of the authentication handshake to rapidly pinpoint UUID/owner/group mismatches.
25
+
26
+ ### `src/invocation/CredentialPreservationService.ts`
27
+ - Use `preserveCredentials()` (not `updateCredentials()`) when storing server UUIDs so entries are created reliably for rejoined members.
28
+ - Added informative logs in `restoreCredentials()` including a compact dump of available entries when a lookup misses.
29
+ - Reason: Ensure server-fed credentials are immediately usable and simplify troubleshooting.
30
+
31
+ ### Heartbeat/connection lifecycle (minor)
32
+ - More explicit close diagnostics in `ClientConnection.js` (call-site stack, state snapshot at closure).
33
+ - Reason: Faster root-cause analysis of disconnects without changing functional behavior.
34
+
35
+ ### Build/config
36
+ - Bumped package version to `3.12.5-16` to reflect internal changes.
37
+ - Replaced fragile dynamic requires with static imports where applicable to fix constructor/type issues during compile/runtime.
38
+ - Reason: Eliminate "require(...).default is not a constructor"-style failures and ensure clean builds.
39
+
40
+ ### Behavior & policy (summary)
41
+ - Server-first topology/authentication: the server is authoritative for member list and credentials.
42
+ - Owner transition correctness: old owner rejoins as child; owner promotion only when needed.
43
+ - Prevent connection explosion: conservative retries, no reconnect storms.
44
+ - `refresh` remains untouched by design.
45
+
46
+ ### Outcomes
47
+ - Invalid Credentials eliminated by syncing client UUIDs/ownerUuid to server state.
48
+ - Seamless failover/recovery for both owner and child nodes.
49
+ - Stable connection counts (typically 1–3 per node).
50
+ - Targeted, production-ready logs for authentication and connection lifecycle.
51
+
52
+