Internal error - type does not have a visitor

Hello there. I’m new to zeek and to coding in general.
What does that error mean?

[internal-error] t104.spicy:740:12-743:2: codegen: type T104::QOS does not have a visitor

The code that caused the error :

type QOS = bitfield(8) {
    ql : 0..6; 
    se : 7;  
};

I suspect the error message you are seeing also mentions that this is an internal-error somewhere. In general internal-errors are probably due to Spicy bugs.

The concrete issue you are seeing here is

A possible workaround is to wrap your bitfield type declaration in a unit similar to what I described in the issue, e.g.,

type QOS = unit {
	x: bitfield(8) {
		ql: 0..6;
		se: 7;
	};
} &convert=self.x;

The trick here is that a unit allows us to introduce a new name for a parsing construct, but we can remove that extra level of indirection again with &convert=self.x.

@Benjamin_Bannier
Thanks a lot for your helpful and quick responses!

Now I got the next error:

fatal error: error during compilation: <Spicy Plugin for Zeek>: JIT compilation failed

What could cause that error?

Is this the full output you are seeing?

Yes, only that one line

This would mean that the C++ compiler which we start to JIT code returned an error, but gave no output.

One scenario where that could happen is if the compiler was killed by the OS since it ran out of available RAM. You could force Spicy to use at most a single C++ compiler process by setting the in your environment export HILTI_JIT_PARALLELISM=1, see 6. Toolchain — Spicy v1.6.0-dev.147.

I added 3gb ram to VM(4bg total) this time and tried to run zeek again. Now it’s the same error but with the termination message:

c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
fatal error: error during compilation: <Spicy Plugin for Zeek>: JIT compilation failed

I think it should be the same as previous attempt. I dont know if it’s important but it took around 10 minutes of compiling before error showed up. Should I add more ram and try again?

This is the same kind of error.

It is really hard to tell what is going on exactly with what you shared, but I would expect a single JIT job to need between 500 MB (if using Clang), and 2-3GB (if using GCC). You can check which compiler Spicy uses by default by running spicy-config --cxx. Alternatively, you can override the compiler by setting HILTI_CXX.

If this does not help, also try setting HILTI_JIT_PARALLELISM=1 like I suggested above. If you are running Spicy before 1.5.0 you need to set HILTI_JIT_SEQUENTIAL=1 instead, but you should not use any version that old.

spicy-config --cxx showed
/usr/bin/c++ as an output.
Could you tell me please exaclty how to set HILTI_JIT_PARALLELISM=1 ? Sorry, I’m completely new to all that.

I got the latest stable version of zeek couple weeks ago so I think in terms of version of spicy plugin it should be the latest one.

Spicy interprets a number of environment variables like e.g., HILTI_JIT_PARALLELISM. If you are running from a shell (e.g., Bash in some terminal), you can set them for your shell session and all processes started from it by running the following in your shell

export HILTI_JIT_PARALLELISM=1

You might want to familiarize yourself with working with a shell. There are a number of tutorials for that, e.g., this articel on variables in Bash on TLDP

https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_02.html

Thank you very much for your time and help!