Skip to content

Race issue trying to detect prompt #232

Description

@tmpfs

Hi,

I think I have detected a bug with the prompt handling in atat.

I am trying to send AT+HTTPCPOST (docs) to an ESP32 and am getting the response buffer as:

\r\n\r\nOK\r\n\r\n>

The OK is detected which will reply to the command (which is marked with NoResponse) and the reply to the send() call will be dispatched but as the prompt is processed synchronously we see the error before the send() completes - the completion of send() is the log line with "success" here:

3.503936 [INFO ] make POST request (http_test http-test/src/main.rs:161)
3.504852 [DEBUG] Sending command with long payload (50 bytes) (atat src/asynch/client.rs:42)
3.506042 [DEBUG] parse (raw): 2 b"\xfe\x00" (rac_core at/esp32/mod.rs:57)
3.569641 [DEBUG] parse (raw): 4 b"\xfe\x00AT" (rac_core at/esp32/mod.rs:57)
3.570617 [DEBUG] parse (raw): 15 b"\xfe\x00AT+HTTPCPOST=" (rac_core at/esp32/mod.rs:57)
3.572052 [DEBUG] parse (raw): 31 b"\xfe\x00AT+HTTPCPOST=\"http://192.168." (rac_core at/esp32/mod.rs:57)
3.573944 [DEBUG] parse (raw): 2 b"\r\n" (rac_core at/esp32/mod.rs:57)
3.574676 [DEBUG] Received echo or whitespace (50/52): b"\xfe\x00AT+HTTPCPOST=\"http://192.168.1.3:8080/post\",17,0\r\n" (atat atat/src/ingress.rs:228)
3.576141 [DEBUG] parse (raw): 2 b"\r\n" (rac_core at/esp32/mod.rs:57)
3.577850 [DEBUG] parse (raw): 4 b"\r\n\r\n" (rac_core at/esp32/mod.rs:57)
3.578857 [DEBUG] parse (raw): 11 b"\r\n\r\nOK\r\n\r\n>" (rac_core at/esp32/mod.rs:57)
3.579650 [DEBUG] Received OK (8/11) (atat atat/src/ingress.rs:268)
3.580627 [DEBUG] parse (raw): 3 b"\r\n>" (rac_core at/esp32/mod.rs:57)
3.581237 [DEBUG] Received prompt (3/3) (atat atat/src/ingress.rs:239)
3.581604 [ERROR] Received prompt but a response is already pending (atat atat/src/ingress.rs:242)
3.582153 [INFO ] success (http_test http-test/src/main.rs:172)

Perhaps I am doing something wrong or do you think this is genuinely a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions