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

delete check: wrong status code when an object contains zero-length name #78

Open
yoursunny opened this issue Feb 13, 2024 · 1 comment

Comments

@yoursunny
Copy link
Contributor

yoursunny commented Feb 13, 2024

Environment:

  • Ubuntu 22.04 in LXC container
  • Python 3.10.12
  • ndn-python-repo installed into venv with this command:
    pip install git+https://github.com/UCLA-IRL/ndn-python-repo@dafd23dcc25bf9c130a110e37b66d6d1683a8212
  • ndn-python-repo started with empty database and default settings

When ndn-python-repo receives a delete command that contains an ObjectParam with a Name field of TLV-LENGTH zero, the corresponding delete check command is returning top-level status 404 instead of the expected 200.

Packet trace: 1.pcapng.zip

The packet trace contains a "normal" delete command with non-zero-length name:

  • RepoCommandParam in frame 14
  • RepoCommandRes in frame 20: top-level StatusCode is 200, ObjectResult has StatusCode=200 and DeleteNum=0

The packet trace contains an abnormal delete command with zero-length name:

  • RepoCommandParam in frame 24
  • RepoCommandRes in frame 28: top-level StatusCode is 404, ObjectResult is missing

According to NDN packet format, the zero-length name 0700 is a valid Data name.
If the repo does not have a packet with this name, it should be respond in the same way as deleting a non-existent packet, i.e. like frame 20.

ndn-python-repo console output
[2024-02-13 15:15:39,642]INFO:Read handle: listening to /
[2024-02-13 15:15:39,646]INFO:TCP insertion handle serving on ('0.0.0.0', 7376)
[2024-02-13 15:15:39,648]INFO:Subscribing to topic (with interest filter): /testrepo/insert
[2024-02-13 15:15:39,649]INFO:Subscribing to topic (with interest filter): /testrepo/delete
[2024-02-13 15:15:43,461]INFO:received subscribed msg: /localhost/seq=1521893051/msg/testrepo/delete/%83%B25s%0F%FE%8AN
[2024-02-13 15:15:43,504]INFO:Recved delete command: 39dcbd3b6a7095afb9943898aae0f9ba96fa00f5caf68ab9c2f93d390b99f4fe
[2024-02-13 15:15:43,513]INFO:Deletion 39dcbd3b6a7095afb9943898aae0f9ba96fa00f5caf68ab9c2f93d390b99f4fe name=/NDNts-pyrepo/9495757 finish:0 deleted
[2024-02-13 15:15:43,513]INFO:Deletion 39dcbd3b6a7095afb9943898aae0f9ba96fa00f5caf68ab9c2f93d390b99f4fe done, total 0 deleted.
[2024-02-13 15:15:44,417]INFO:on_check_interest(): /testrepo/delete%20check/params-sha256=f3c2415218c93a6bc54e1606239be88cd8d3a9a6912848996fcffb55c81dd8b9
[2024-02-13 15:15:44,417]INFO:Reply to command: /testrepo/delete%20check/params-sha256=f3c2415218c93a6bc54e1606239be88cd8d3a9a6912848996fcffb55c81dd8b9 w/ code=200
[2024-02-13 15:15:44,424]INFO:received subscribed msg: /localhost/seq=1521893051/msg/testrepo/delete/%5D5%1C%B43%80%01%8F
[2024-02-13 15:15:44,424]WARNING:Parameter interest blob decoding failed w/ exception: Missing name for one or more objects
[2024-02-13 15:15:45,506]INFO:on_check_interest(): /testrepo/delete%20check/params-sha256=9f1925567e88c99d58a369d721e1e902bfc95ee1286e86b8a41ab2cb29f8e522
[2024-02-13 15:15:45,506]WARNING:Process does not exist for id=<memory at 0x7f74ad62c7c0>
[2024-02-13 15:15:45,507]INFO:Reply to command: /testrepo/delete%20check/params-sha256=9f1925567e88c99d58a369d721e1e902bfc95ee1286e86b8a41ab2cb29f8e522 w/ code=404
zjkmxy added a commit that referenced this issue Feb 14, 2024
@zjkmxy
Copy link
Collaborator

zjkmxy commented Feb 14, 2024

The current code drops some of the requests before processing, while the spec requires it to at least mark it as MALFORMED. Let me think how to fix this.
The latest commit should be able to handle empty Names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants