# Command processing stage

**URL:** <https://forum.codecrafters.io/t/command-processing-stage/470>\
**Category:** Challenges\
**Tags:** challenge:redis\
**Created:** [May 22, 2024, 2:14pm UTC](https://forum.codecrafters.io/t/command-processing-stage/470 "2024-05-22T14:14:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aryan-011](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/aryan-011/32/256_2.png) [@aryan-011](https://forum.codecrafters.io/u/aryan-011)\
**Post date:** [May 22, 2024, 2:14pm UTC](https://forum.codecrafters.io/t/command-processing-stage/470/1 "2024-05-22T14:14:55Z")

</div>

I’m stuck on the commnad processing stage .

I’ve tried creating a new thread for the replica to process command independent of the master.

While , out of the three get commands the first two work as it should but the third command gets a null string . I cannot seem to understand why the replica is unable to process the third set command

Here are my logs:

```auto
client: Sent bytes: "*2\r\n$3\r\nGET\r\n$3\r\nfoo\r\n"
[your_program] Received: +FULLRESYNC 75cd7bc10c49047e0d163660f3b90625b1af31dc 0
[your_program] x�ώ
[your_program] Waiting for a client to connect...
[your_program] Received: $88
[your_program] REDIS0011�	redis-ver7.2.0�
[your_program] redis-bits�@�ctime�m�e�used-mem°�
[your_program] Client connected
[your_program] Received: *3
[your_program] $3
[your_program] SET
[your_program] $3
[your_program] foo
[your_program] $3
[your_program] 123
[your_program] �
[your_program] redis-bits�@�ctime�m�e�used-mem°�
[your_program] Received: *3
[your_program] $3
[your_program] SET
[your_program] $3
[your_program] bar
[your_program] $3
[your_program] 456
[your_program] *3
[your_program] $3
[your_program] SET
[your_program] $3
[your_program] baz
[your_program] $3
[your_program] 789
[your_program] d-mem°�
[your_program] Received: *2
[your_program] $3
[your_program] GET
[your_program] $3
[your_program] foo
[your_program] 
[tester::#YG4] client: Received bytes: "$3\r\n123\r\n"
[tester::#YG4] client: Received RESP value: "123"
[tester::#YG4] Received "123"
[tester::#YG4] Getting key bar
[tester::#YG4] client: $ redis-cli GET bar
[tester::#YG4] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$3\r\nbar\r\n"
[your_program] Received: *2
[your_program] $3
[your_program] GET
[your_program] $3
[your_program] bar
[your_program] 
[tester::#YG4] client: Received bytes: "$3\r\n456\r\n"
[tester::#YG4] client: Received RESP value: "456"
[tester::#YG4] Received "456"
[tester::#YG4] Getting key baz
[tester::#YG4] client: $ redis-cli GET baz
[tester::#YG4] client: Sent bytes: "*2\r\n$3\r\nGET\r\n$3\r\nbaz\r\n"
[your_program] Received: *2
[your_program] $3
[your_program] GET
[your_program] $3
[your_program] baz
[your_program] 
[tester::#YG4] client: Received bytes: "$-1\r\n"
[tester::#YG4] client: Received RESP value: NIL

```

link to my [repo](https://github.com/aryan-011/codecrafters-redis-cpp/blob/master/src/Server.cpp)

---

<div class="post-metadata">

**Author:** ![aryan-011](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/aryan-011/32/256_2.png) [@aryan-011](https://forum.codecrafters.io/u/aryan-011)\
**Post date:** [May 23, 2024, 7:51am UTC](https://forum.codecrafters.io/t/command-processing-stage/470/2 "2024-05-23T07:51:29Z")

</div>

the problem was ,I wasnt handling Resp arrays correctly and the multiple commands were sent at once .

You can now close this

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [May 28, 2024, 7:52am UTC](https://forum.codecrafters.io/t/command-processing-stage/470/3 "2024-05-28T07:52:26Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
