UCLA-IRL / ndn-python-repo

An NDN Repo implementation in Python
Apache License 2.0
16 stars 13 forks source link

Strange behavior when inserting existing data #21

Closed Pesa closed 4 years ago

Pesa commented 4 years ago

If I try to insert the same data (same prefix) multiple times (sequentially), ndn-python-repo seems to hang after the first attempt. I'm not sure what the behavior should be in this case, but if it's forbidden it should return a clear error instead of hanging/timing out.

[2020-02-23 14:05:13]INFO:Existing Prefix Found: /my/license
[2020-02-23 14:05:13]INFO:Read handle: listening to /my/license
[2020-02-23 14:05:13]INFO:TCP insertion handle serving on ('0.0.0.0', 7376)
[2020-02-23 14:05:57]INFO:Write handle processing insert command: [<memory at 0x7f2690be96d0>, <memory at 0x7f2690be97a0>], 0, 0
[2020-02-23 14:05:57]INFO:Reply to command: /testrepo/insert/%07%0D%08%02my%08%07license%CC%01%00%CD%01%00
14:05:57.850918 Express Interest: /my/license/0
14:05:57.852835 Received data: /my/license/0

[2020-02-23 14:06:21]INFO:Write handle processing insert command: [<memory at 0x7f268f743460>, <memory at 0x7f268f743530>], 0, 0
[2020-02-23 14:06:21]INFO:Reply to command: /testrepo/insert/%07%0D%08%02my%08%07license%CC%01%00%CD%01%00
14:06:21.325660 Express Interest: /my/license/0
14:06:21.326384 Received data: /my/license/0

^C[2020-02-23 14:06:48]INFO:Receiving Ctrl+C, shutdown
[2020-02-23 14:06:48]ERROR:Task was destroyed but it is pending!
task: <Task pending coro=<WriteCommandHandle._process_insert() done, defined at /home/davide/.local/lib/python3.7/site-packages/ndn_python_repo/handle/write_command_handle.py:47> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f268f740990>()]>>
[2020-02-23 14:06:48]ERROR:Task was destroyed but it is pending!
task: <Task pending coro=<WriteCommandHandle._process_insert() running at /home/davide/.local/lib/python3.7/site-packages/ndn_python_repo/handle/write_command_handle.py:77> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f2690bccd90>()]>>
JonnyKong commented 4 years ago

Sorry but I could not produce the error. Could you provide more details?

The behavior on my side is as follows:

[2020-02-23 12:33:09]INFO:Existing Prefix Found: /test1.txt
[2020-02-23 12:33:09]INFO:Read handle: listening to /test1.txt
[2020-02-23 12:33:09]INFO:TCP insertion handle serving on ('0.0.0.0', 7376)

[2020-02-23 12:33:12]INFO:Write handle processing insert command: [<memory at 0x10971e6d0>], 0, 0
[2020-02-23 12:33:12]INFO:Reply to command: /testrepo/insert/%07%0B%08%09test1.txt%CC%01%00%CD%01%00
12:33:12.461945 Express Interest: /test1.txt/0
12:33:12.463094 Received data: /test1.txt/0
[2020-02-23 12:33:12]INFO:Segment insertion success, 1 items inserted
[2020-02-23 12:33:12]INFO:on_check_interest(): /testrepo/insert%20check/%CE%04yQ%0E4
[2020-02-23 12:33:12]INFO:Reply to command: /testrepo/insert%20check/%CE%04yQ%0E4

[2020-02-23 12:33:21]INFO:Write handle processing insert command: [<memory at 0x1098ebef0>], 0, 0
[2020-02-23 12:33:21]INFO:Reply to command: /testrepo/insert/%07%0B%08%09test1.txt%CC%01%00%CD%01%00
12:33:21.780135 Express Interest: /test1.txt/0
12:33:21.781447 Received data: /test1.txt/0
[2020-02-23 12:33:21]INFO:Segment insertion success, 1 items inserted
[2020-02-23 12:33:21]INFO:on_check_interest(): /testrepo/insert%20check/%CE%04%0D%C5J%98
[2020-02-23 12:33:21]INFO:Reply to command: /testrepo/insert%20check/%CE%04%0D%C5J%98

^C[2020-02-23 12:33:24]INFO:Receiving Ctrl+C, shutdown
Pesa commented 4 years ago

Probably same as #22, there's a bug in the latest released version but the version from git HEAD seems to work.