https://github.com/stephenlb/c-core-subscribe-issue-reproduction
https://github.com/stephenlb/c-core-subscribe-issue-reproduction
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stephenlb/c-core-subscribe-issue-reproduction
- Owner: stephenlb
- Created: 2025-07-07T16:28:18.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-07T17:48:45.000Z (12 months ago)
- Last Synced: 2025-07-07T18:54:13.381Z (12 months ago)
- Language: C
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PubNub C-Core v5.1.1 Subscribe Bug - Reproduction Summary
## Summary
A reproduction case has been created for the reported PubNub C-Core v5.1.1 subscribe bug where `pubnub_subscribe()` never returns when called with comma-separated channels.
**Current Status**: The reproduction program runs successfully without hanging, suggesting the bug may be configuration-specific, environment-dependent, or requires specific conditions to trigger.
## Test Environment
- **Platform**: macOS 14.5.0 (Darwin 24.5.0)
- **Compiler**: Apple Clang
- **PubNub Version**: v5.1.1 (updated from v5.1.0)
- **Test Date**: 2025-07-07
## Test Results
### Latest Test Run (2025-07-07 14:03:45)
**Build Command**:
```bash
./setup_and_test.sh
./setup_and_test.sh --run
```
**Result**: ✅ **SUCCESSFUL EXECUTION**
```
[2025-07-07 14:03:45] Step 6: Calling pubnub_subscribe with comma-separated channels...
Channels: 'test_channel_1,test_channel_2'
Channel Group: NULL
[2025-07-07 14:03:45] pubnub_subscribe returned with result: 14
[2025-07-07 14:03:45] Subscribe started successfully, now calling pubnub_await...
[2025-07-07 14:03:45] Step 7: Calling pubnub_await...
[2025-07-07 14:03:45] pubnub_await returned with result: 0
[2025-07-07 14:03:45] ✓ Subscribe completed successfully
```
**Test Results Summary**:
- **Setup**: ✅ PubNub C-Core v5.1.1 downloaded and compiled successfully
- **Compilation**: ✅ Reproduction program compiled with 2 warnings (unused variables)
- **Execution Time**: < 1 second
- **pubnub_subscribe()** returned `PNR_STARTED` (14) immediately ✅
- **pubnub_await()** completed with `PNR_OK` (0) ✅
- **No hanging behavior observed** ✅
- **Publish test**: ✅ Completed successfully with connection verified
## Reproduction Program Details
### Exact API Call Sequence (Matches User Report)
```c
pubnub_t *ctx = pubnub_alloc(); // ✅ Step 1
pubnub_init(ctx, "demo", "demo"); // ✅ Step 2
pubnub_use_http_keep_alive(ctx); // ✅ Step 3
pubnub_set_user_id(ctx, "bug_reproduction_user"); // ✅ Step 4
pubnub_set_auth(ctx, "test_auth_key"); // ✅ Step 5 (now included)
pubnub_subscribe(ctx, "test_channel_1,test_channel_2", NULL); // ✅ Step 6
pubnub_await(ctx); // ✅ Step 7
pubnub_get(ctx); // ✅ Step 8
```
### Key Parameters (Matches User Report)
- **Channels**: `"test_channel_1,test_channel_2"` (comma-separated list of 2 channels) ✅
- **Channel Group**: `NULL` ✅
- **Logging**: `PUBNUB_LOG_LEVEL_TRACE` enabled ✅
### Safety Features Implemented
- **Timeout Protection**: 10-second transaction timeout to prevent infinite hanging
- **Signal Handling**: Graceful exit on Ctrl+C
- **Comprehensive Logging**: Timestamped debug output at each step
- **Error Code Interpretation**: Detailed result code analysis
## Analysis
### Why the Bug Might Not Be Reproducing
1. **Platform Differences**:
- User environment (likely Linux/embedded) vs test environment (macOS)
- Different networking stack behavior
2. **Build Configuration**:
- Different compiler flags or preprocessor definitions
- Threading model differences (`PUBNUB_THREADSAFE` settings)
- Memory allocation strategy differences
3. **Network Environment**:
- Corporate proxy/firewall settings
- Network latency or connectivity issues
- DNS resolution differences
4. **Runtime Conditions**:
- System resource constraints
- Multi-threading race conditions
- Memory pressure scenarios
### Evidence Supporting Bug Existence
1. **User's Specific Environment**: Bug may be environment-specific
2. **Version Timing**: Issue appeared specifically in v5.1.1, suggesting architectural changes
3. **Configuration Dependencies**: Different build configurations may trigger the issue
## Deliverables
### Files
1. **`pubnub_subscribe_bug_reproduction.c`**: Complete reproduction program
2. **`setup_and_test.sh`**: Automated setup and compilation script
3. **`Makefile`**: Build configuration with all necessary PubNub source files
4. **`COMPILE_INSTRUCTIONS.md`**: Comprehensive compilation guide
5. **`README_RESULTS.md`**: Detailed test results and analysis
### Compilation Instructions
```bash
# Quick setup (downloads PubNub C-Core v5.1.1 and compiles)
./setup_and_test.sh
# Run the reproduction test
./setup_and_test.sh --run
```