Proposal: Helping catch infloop issues sooner

Hello,

This proposal is like a “lessons learned” off-shoot from this earlier infloop debug I went through today.

Show templateMetrics till the point when user hits Ctrl + C

If hugo is run with --templateMetrics, would it be possible to catch the Ctrl + C from the terminal and auto-display templateMetrics collected till the time Ctrl + C was hit?

The resultant report can then hint the user where in the templates things got stuck.

Finer Breakdown of “culprits” in the templateMetrics report

Also, further on templateMetrics, can that feature record the callers of partials, templates, etc. too? In my instance, I have that debugprint,html partial that’s used in all template files… so knowing that it’s called the highest number of times is not very useful.

But a finer characterization would be more helpful… like layouts/_default/terms.html -> partial debugprint.html, themes/FOO/layouts/index.html -> partial debugprint.html, and so on…
In that infloop issue, I was lucky to catch that issue… *shower debug*… something didn’t feel right about tagging a page that lists tags.

But having Ctrl+C based templateMetrics + a finer breakdown would easily catch such infloops.

\cc @moorereason @bep

These are very marginal issues. Maybe important to you, but now something that will benefit many. So I’m not spending time on this. We are not making the metrics report more fine grained, but if someone wants to do something about the ctrl-c, go ahead. But not me.

1 Like

By the way, the metrics report is not made for debugging issues like the one you mentioned. It is a performance tool.