Dialyzer error: Old PLT file

I’m working with a team that are running (relatively) old versions of Elixir and Erlang. Last month I added dialyzer, via dialyxir (can never spell that) to their build. Today we are running into an issue:

:dialyzer.run error: Old PLT file /apps/[redacted]/priv/plts/application.plt

The build is on Azure. The PLTs are cached using Azure Pipeline caching (here if you want to know but I wouldn’t if I could avoid it).

Dialyxir config is

  defp dialyzer do
    [
      plt_add_apps: [:mix, :ex_insights],
      plt_file: {:no_warn, "priv/plts/application.plt"},
      ignore_warnings: "dialyzer.ignore_warnings"
    ]
  end

The plts are excluded from source control.

Versions:

elixir 1.14.2-otp-25
erlang 25.3.2.6

I know I can fix the issue by invalidating the cache but I would like to understand how it happened in the first place. The only thing I’ve been able to find is this somewhat cryptic Erlang mailing list q&a. Old PLT file? .

The checking is going on here which looks like there is some discrepancy between an internally held hash in the PLT and the file contents.

Thoughts?

Here is the place in code where this error is raised: otp/lib/dialyzer/src/dialyzer_cplt.erl at 53ffb6a1363180ec67c36e3baa9745ee73e7b5a3 · erlang/otp · GitHub

I cannot figure out though what the code tries to accomplish, it seems there is some kind of file tracking involved.

Does this happen after invalidating the cache?

I did link to that in my question :wink:

I am about to invalidate the cache. It definitely doesn not happen locally.

[edit s/no/not/]

1 Like

NVM, my bad, I’ve noticed only the mail listing link.

My assumption is that the PLT format is somehow versioned and you upgraded dialyzer version along the way. I would say that if invalidating the cache fixes the situation, then this issue falls most probably on some weird initial setup.

Yeah, the link was pretty subtle. It looks like the PLT is an erlang record, stored as a binary term which contains a version and an MD5 hash and if hash does not agree with a recomputed hash then it is an old plt. I don’t get it. ¯\(°_o)/¯☕️

Still not solved, but I have not spent a ton of time trying to dig into the Erlang dialyzer code. Some more context though.

This is not a single plt file becoming somehow corrupt. Azure Pipelines being Azure Pipelines, caching is isolated to a specific branch. This error was occurring across multiple PR builds. Also the main build, which uses a different cache key, also got the error. Each PLT became old on the 7th of Jan.

As mentioned we’re using dialyxir . Briefly looking at the output it checks that the plt is up to date before running dialyzer with checking disabled .

So the output looks like

Checking PLT...
[(redacted the list of applications), ...]
PLT is up to date!
ignore_warnings: dialyzer.ignore_warnings

Starting Dialyzer
[
  check_plt: false,
  init_plt: '(redacted)/priv/plts/application.plt',
  files: [(redacted the list of files)],
  warnings: [:unknown]
]
:dialyzer.run error: Old PLT file (redacted)/priv/plts/application.plt

Also I have checked and at that time:

  • there was no change to any dependencies
  • no change to the dialyzer config
  • no change to Elixir and Erlang versions

Even if there were, I don’t see how it could have affected multiple pipelines given the cache isolation.

Did invalidating of cache help?

1 Like

Yes, thanks. Building and caching a new plt worked.

1 Like