Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up a stream over JS API subject breaks the API #3531

Closed
2 tasks done
AlbericC opened this issue Oct 8, 2022 · 2 comments
Closed
2 tasks done

Setting up a stream over JS API subject breaks the API #3531

AlbericC opened this issue Oct 8, 2022 · 2 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@AlbericC
Copy link

AlbericC commented Oct 8, 2022

Defect

If a stream is created that covers the JS API subject (or any of its child subjects), then all the API messages covered by the stream definition are grabbed by JS and replied to with JS ACKs, effectively breaking the API and possibly making the deletion of the stream impossible.

Make sure that these boxes are checked before submitting your issue -- thank you!

Versions of nats-server and affected client libraries used:

any library client
any NATS-server version since JetStream (tested today on 2.9.2)

OS/Container environment:

any, tested today on windows 10, reproduced on linux.

The actual bug is the break of jetstream own protocol by itself, is OS independent

Steps or code to reproduce the issue:

try to create a stream that covers $JS/ the JS api prefix

Expected result:

stream creation would be rejected

Actual result:

creation of the stream :

    nats stream create --config stream.config.json
    Stream anything was created
    
    Information for Stream anything created 2022-10-08T15:49:23+02:00
    
    Configuration:
    
                 Subjects: >
         Acknowledgements: true
                Retention: Memory - Limits
                 Replicas: 1
           Discard Policy: Old
         Duplicate Window: 2m0s
        Allows Msg Delete: true
             Allows Purge: true
           Allows Rollups: false
         Maximum Messages: unlimited
            Maximum Bytes: unlimited
              Maximum Age: unlimited
     Maximum Message Size: unlimited
        Maximum Consumers: unlimited
    
    
    State:
    
                 Messages: 0
                    Bytes: 0 B
                 FirstSeq: 0
                  LastSeq: 0
         Active Consumers: 0

then all the API messages are grabbed by JS and replied to with JS ACKs, effectively breaking the API and making the deletion of the stream impossible.

    nats stream ls
    nats: error: could not list streams: server response is not a valid "io.nats.jetstream.api.v1.stream_list_response" message: /type: value must be "io.nats.jetstream.api.v1.stream_list_response"
    missing properties: 'error'
    /streams: expected array, but got null, try --help

nats -DV output not really useful but attached output.log
stream config file (zipped to pass github's rules ) stream.config.json.zip

@tbeets
Copy link
Contributor

tbeets commented Dec 16, 2022

Thanks @AlbericC . There has been a validation against a stream configuring subjects that overlap with $JS.API.> since v2.2; however, I am seeing that the implementation catches only subjects having the tokens $JS.API.<somemoretokens> and does not catch > or $JS.> etc.

We will consider for the 2.10 release as fixing this validation may cause existing offending streams to not startup.

@derekcollison

@bruth bruth added defect Suspected defect such as a bug or regression and removed 🐞 bug labels Aug 18, 2023
@wallyqs
Copy link
Member

wallyqs commented Aug 28, 2024

Behavior was formalized in v2.10.17 and addressed via #5548

@wallyqs wallyqs closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants