p4lang / tutorials

P4 language tutorials
Apache License 2.0
1.35k stars 886 forks source link

There seems to be a problem when I run calc.p4 #608

Closed hugo0819 closed 4 months ago

hugo0819 commented 4 months ago

As a beginner I was able to run the first two basic sketches smoothly, but when I ran this one there were some issues that couldn't be solved. The following is the relevant error information...

hugo@hugovm:~/P4/tutorials/exercises/calc$ make mkdir -p build pcaps logs p4c-bm2-ss --p4v 16 --p4runtime-files build/calc.p4.p4info.txt -o build/calc.json calc.p4 [--Wwarn=deprecated] warning: .txt format is being deprecated; use .txtpb instead sudo python3 ../../utils/run_exercise.py -t topology.json -j build/calc.json -b simple_switch_grpc Reading topology file. Building mininet topology. simple_switch_grpc -i 1@s1-eth1 -i 2@s1-eth2 --pcap /home/hugo/P4/tutorials/exercises/calc/pcaps --nanolog ipc:///tmp/bm-0-log.ipc --device-id 0 build/calc.json --log-console --thrift-port 9090 -- --grpc-server-addr 0.0.0.0:50051

Configuring switch s1 using P4Runtime with file s1-runtime.json

fruffy commented 4 months ago

This error may occur when either your version of P4Runtime or the compiler is out of date.

@jafingerhut This seems to happen a lot, maybe because https://pypi.org/project/p4runtime/ is out of date?

jafingerhut commented 4 months ago

I am doing my monthly test of builds using my install-p4dev-v6, -v7, and a newer -v8 buidl script in my p4-guide repo to test that they still all work with the latest versions of p4lang repo source code, and will try out the ecn tutorials exercise on each of them to see what happens, and report back the results in a comment here.

hugo0819 commented 4 months ago

I am doing my monthly test of builds using my install-p4dev-v6, -v7, and a newer -v8 buidl script in my p4-guide repo to test that they still all work with the latest versions of p4lang repo source code, and will try out the ecn tutorials exercise on each of them to see what happens, and report back the results in a comment here.

I used install-p4dev-v6 to build my p4 project in 22.04LST. Looking forward to your test

jafingerhut commented 4 months ago

@hugo0819 Do you recall when it was that you used install-p4dev-v6 to install the open source P4 tools?

With the latest version of the source that I tested with yesterday, on 22.04 and also 20.04, I saw no such error message when running the ecn exercise.

hugo0819 commented 4 months ago

@hugo0819 Do you recall when it was that you used install-p4dev-v6 to install the open source P4 tools?

With the latest version of the source that I tested with yesterday, on 22.04 and also 20.04, I saw no such error message when running the ecn exercise.

Yes, I found install-p4dev-v6 updated, do I just need git new p4/guide to run it again?

jafingerhut commented 4 months ago

Unfortunately, I am fairly certain that trying to run my install script twice on the same system will either (a) not install anything new, or worse (b) mess up the installation so that it no longer works. I do not regularly test what happens if you try to do this. That is why you find the following statement on this page of instructions https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md#quick-instructions-for-successful-install-script-run

Yes, that means that it takes longer to achieve an updated system. I typically only do this once every month or two, but once you have one you like, there is rarely any strong reason to update again.

jafingerhut commented 4 months ago

Another option is to download a recent Virtual Machine image that can be loaded into VirtualBox (and maybe also other VM player systems, but I have not tested on others) from here: https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md

jafingerhut commented 4 months ago

This error may occur when either your version of P4Runtime or the compiler is out of date.

@jafingerhut This seems to happen a lot, maybe because https://pypi.org/project/p4runtime/ is out of date?

Fabian, I believe that my p4-guide install scripts do not use that p4runtime package at all, instead installing it from recent source code. If someone does not use my install scripts, then perhaps that might be leading to the problem asked about in this issue -- I have not tried it to confirm.

I am sure there was something like a 1 month or so window of time where using my scripts would also lead to this problem, because of differences in when different repos were updated to add this new P4Info message field.

hugo0819 commented 4 months ago

In fact, when I ran install-p4dev-v6 again from a new virtual machine, I encountered installation errors again. It seems to be an issue with displaying Python related packages, where one package was supposed to be found but two were found, resulting in the inability to continue the installation. Fortunately, when I adopted install-p4dev-v7, the installation was successfully completed and ran on two new virtual machines.

jafingerhut commented 4 months ago

@hugo0819 Please feel free to close this issue if you believe it has been solved.