question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ArrayOutput stops response parsing on empty nested arrays

See original GitHub issue

Bug Report

Current Behavior

When using the redis-cell module v0.2.5 the list of redis commands that Lettuce loads is truncated.

In ReidsCommandFactory.java I put a breakpoint at the return of getCommands - from there I can see that commands contains 137 elements when the redis-cell module is loaded, and 204 when it is not loaded.

In redis-cli I run monitor and see the COMMAND is used to get the list of commands. When I run that with redis-cell loaded I get 205 entries.

Looking at the list of entries I see the 138th entry is

138) 1) "cl.throttle"
     2) (integer) -1
     3) 1) write
     4) (integer) 0
     5) (integer) 0
     6) (integer) 0
     7) (empty array)

For some reason Lettuce stops reading the list of commands at that point.

Expected behavior/code

The full list of 205 commands should be returned. My custom “CL.THROTTLE” lettuce command should work.

Environment

  • Lettuce version(s): 5.3.1
  • Redis version: 6.0.1
  • redis-cell 0.2.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mp911decommented, Jun 30, 2020

Thanks for reporting the issue. The bug is that ArrayOutput doesn’t consider nested empty arrays and therefore response processing terminates once the response contains an empty array element.

 69) 1) "hget"
     2) (integer) 3
     3) 1) readonly
        2) fast
     4) (integer) 1
     5) (integer) 1
     6) (integer) 1
     7) 1) @read
        2) @hash
        3) @fast
 70) 1) "cl.throttle"
     2) (integer) -1
     3) 1) write
     4) (integer) 1
     5) (integer) 1
     6) (integer) 1
     7) (empty array)
0reactions
TheCycoONEcommented, Jun 30, 2020

Confirmed working with 5.3.2.BUILD-SNAPSHOT. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript, JSON: Mapping nested array always returns empty
As for the answer, I think you do not need to typecast the response into a typical Interface. A simple .map(res => res.json());...
Read more >
Nested field type | Elasticsearch Guide [8.5] | Elastic
The nested type is a specialised version of the object data type that allows arrays of objects to be indexed in a way...
Read more >
print_r - Manual - PHP
Here is another version that parses the print_r() output. I tried the one posted, but I had difficulties with it. I believe it...
Read more >
Empty arrays and collections should be returned instead of null
Returning null instead of an actual array, collection or map forces callers of the method to explicitly test for nullity, making them more...
Read more >
HTTP output object instead of array - how to process?
1) Parse the JSON response. 2) Create an Empty array variable. 3) Append the Parse JSON body into this array variable. 4) In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found