DASH icon indicating copy to clipboard operation
DASH copied to clipboard

Garbage characters in bmv2 log message during table error

Open chrispsommers opened this issue 4 years ago • 11 comments

During a CI pipeline run the following console output was observed:

docker exec -w /tests/vnet_out simple_switch-runner ./vnet_out
GRPC call SetForwardingPipelineConfig 0.0.0.0:9559 => /etc/dash/dash_pipeline.json, /etc/dash/dash_pipeline_p4rt.txt
GRPC call Write::add_one_entry OK: GRPC call Write::add_one_entry OK: GRPC ERROR[2]: , `
type.googleapis.com/p4.v1.Error=&Missing non-ternary field in match keyALL-sswitch-p4orgGRPC call Write::add_one_entry ERROR: 
table_id: 34579306 action { action { action_id: 17187022 params { param_id: 1 value: "\t\000\000" } } }double free or corruption (fasttop)

We need to clean up the output, make it more sensible and suppress binary junk from appearing on the console if possible. This might take some effort if the output is coming from existing P4RT libraries.

chrispsommers avatar Jul 27 '22 23:07 chrispsommers

UTF-8 ?, maybe take the source file and convert it to ASCII and see if you get any errors about chars that cannot be converted.

mgheorghe avatar Aug 08 '22 19:08 mgheorghe

I think it's emitting raw octet streams from the gRPC P4Runtime message, needs some exploring.

chrispsommers avatar Aug 08 '22 19:08 chrispsommers

@chrispsommers Do you still see the same binary junk? I'm seeing a case of failed programming from P4Runtime gRPC but there is no non-ascii char in the output.

e:- mutateTableEntry: GRPC ERROR[2]: ,L type.googleapis.com/p4.v1.ErrorInvalid match typeALL-sswitch-p4org e:- mutateTableEntry: GRPC call Write::INSERT ERROR: table_id: 38920290 match { field_id: 1 exact { value: "\0003" } } match { field_id: 2 exact { value: "\000\000e" } } match { field_id: 3 } action { action { action_id: 27844834 } }

ashutosh-agrawal avatar Mar 05 '24 00:03 ashutosh-agrawal

@ashutosh-agrawal I haven't tried it in a long time, but @kcudnik did some changes in this area some months ago if I recall; it might have fixed the error. If you don't see it anymore we can close it.

chrispsommers avatar Mar 05 '24 00:03 chrispsommers

@KrisNey-MSFT to see if this issue can be closed.

ashutosh-agrawal avatar Mar 05 '24 01:03 ashutosh-agrawal

Do we need to test it during a CI pipeline run?
@ashutosh-agrawal and @chrispsommers

KrisNey-MSFT avatar Mar 05 '24 17:03 KrisNey-MSFT

We would need to add a negative test to expose this.

chrispsommers avatar Mar 05 '24 18:03 chrispsommers

i think i corrected that when i updated logging mechanism

kcudnik avatar Mar 05 '24 19:03 kcudnik

but maybe its not a log problem but return value problem? it was:

LOG("GRPC call Write::" << updateTypeStr(updateType) << " OK" << entry->ShortDebugString() << std::endl);

now its:

DASH_LOG_NOTICE("GRPC call Write::%s OK %s", updateTypeStr(updateType).c_str(), entry->ShortDebugString().c_str());

kcudnik avatar Mar 05 '24 19:03 kcudnik

Agreed, I think using c_str() was the solution. LOG macro is fine, it just didn't get the right types to fill the format strings.

chrispsommers avatar Mar 05 '24 19:03 chrispsommers

so ok to close then? thank you, Kristina

KrisNey-MSFT avatar Mar 11 '24 15:03 KrisNey-MSFT