Comments (6)
Is it a right way to fix it?
from amazon-freertos.
I've just tried replicating this with our standard 'basic' echo server code, as shown below. Unfortunately that didn't exhibit the same issue, so I will try again using the code you posted.
static void prvConnectionListeningTask( void *pvParameters )
{
struct freertos_sockaddr xClient, xBindAddress;
Socket_t xListeningSocket, xConnectedSocket;
socklen_t xSize = sizeof( xClient );
static const TickType_t xReceiveTimeOut = portMAX_DELAY;
const BaseType_t xBacklog = 20;
#if( ipconfigUSE_TCP_WIN == 1 )
WinProperties_t xWinProps;
/* Fill in the buffer and window sizes that will be used by the socket. */
xWinProps.lTxBufSize = ipconfigTCP_TX_BUFFER_LENGTH;
xWinProps.lTxWinSize = configECHO_SERVER_TX_WINDOW_SIZE;
xWinProps.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;
xWinProps.lRxWinSize = configECHO_SERVER_RX_WINDOW_SIZE;
#endif /* ipconfigUSE_TCP_WIN */
/* Just to prevent compiler warnings. */
( void ) pvParameters;
/* Attempt to open the socket. */
xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );
/* Set a time out so accept() will just wait for a connection. */
FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
/* Set the window and buffer sizes. */
#if( ipconfigUSE_TCP_WIN == 1 )
{
FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
}
#endif /* ipconfigUSE_TCP_WIN */
/* Bind the socket to the port that the client task will send to, then
listen for incoming connections. */
xBindAddress.sin_port = tcpechoPORT_NUMBER;
xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
FreeRTOS_listen( xListeningSocket, xBacklog );
for( ;; )
{
/* Wait for a client to connect. */
xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );
configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
/* Spawn a task to handle the connection. */
xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY, NULL );
}
}
from amazon-freertos.
I've just tried replicating this with our standard 'basic' echo server code, as shown below. Unfortunately that didn't exhibit the same issue, so I will try again using the code you posted.
Which version of the FreeRTOS you are using?
Also, could you please share your configuration header?
from amazon-freertos.
[edited from original response]
The config file is here: https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/FreeRTOSIPConfig.h
The difference is presumably the setting of ipconfigTCP_HANG_PROTECTION, as if I set that to 0 then I am able to replicate the issue. The patch you posted above takes out just one of several tests for ipconfigTCP_HANG_PROTECTION - so while setting ipconfigTCP_HANG_PROTECTION to 1 should fix the symptom for you the root of the issue requires more investigation.
from amazon-freertos.
Thanks, @RichardBarry !
For now I will workaround that issue (in my project) by setting ipconfigTCP_HANG_PROTECTION
to 1.
Looking forward for your root cause investigation.
from amazon-freertos.
I assume that setting ipconfigTCP_HANG_PROTECTION
to 1 solves your problem. I am closing this issue. Let us know if you need anything else.
Thanks.
from amazon-freertos.
Related Issues (20)
- [BUG] `CORE_MQTT_MUTUAL_AUTH` Demo: Failed to establish new connection HOT 5
- [BUG] pPublishInfo->payloadLength changes after call to sendPacket HOT 6
- [BUG] MbedTLS version not reflected within git modules. HOT 2
- [BUG] Array bound warning observed in iot_test_tcp.c HOT 2
- [General] Where is esp_hw_support component ? HOT 1
- [Feature Request] Allow to define custom 'help' command in freertos-cli HOT 2
- nvs_flash_init() panics HOT 1
- [BUG] Lacking a check for the return value of mbedtls_ssl_conf_own_cert() HOT 1
- [Feature Request] Update submodule "vendors/espressif/esp-idf" to release/v4.4 of esp-afr-sdk HOT 2
- [General] Unable to access esp-idf ble_wifi_provisioning component HOT 9
- [General] Cannot use Bluedroid, NVS crashes/panics HOT 15
- [General] BLE service to leverage IOT BLE data transfer service HOT 1
- ESP32 compiled binary shows absolute file path when walked through using binwalk HOT 6
- [General] STM32L4 discovary board AWS IoT Tera Term Error HOT 5
- [BUG] ESP32 Port SPI Error with S3 HOT 2
- [BUG] Trace output of ESP32-DevKitC jobs demo is clobbered HOT 2
- [General] Ethernet AWS MQTT DNS Network Error HOT 4
- [General] Is there a reason, why there is almost two months no merge in main? HOT 5
- [General] ESP32S3 OTA fails due to not multiple of 16 bytes
- [General] esp_ota_begin fails in simple example HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-freertos.