Skip to content

Paginator invalid mem. nil pointer on Hugo server #5968

Closed

Description

@regisphilibert

I'm reopening an issue for the problem we're encountering on hugo serve seems to be different than #5885

It happens on some projects but not all, and after having spent hours trying to isolate it on unaffected projets by trying every possible config variations, I just resigned myself to simply post my findings in the hope this will help.

It does not happen systematically, but if you move around the site, cliking in the nav, back and forth, not necessarily while navigating to the page whose template uses Pagination, but others as well, at some point, the crash is going to happen.

I've run one of our "problem" site with --debug and here is what I notice

It always happens after this line:
DEBUG 2019/05/16 12:09:23 creating alias: /blog/page/1/index.html redirecting to http://localhost:1313/blog/

Here's a complete example:

DEBUG 2019/05/16 12:07:56 creating alias: /blog/page/1/index.html redirecting to http://localhost:1313/blog/
ERROR 2019/05/16 12:07:56 Failed to render "/blog/":

ERROR 2019/05/16 12:07:56 Failed to render pages: render of "section" failed: execute of template failed: template: _internal/pagination.html:2:13: executing "_internal/pagination.html" at <$pag.TotalPages>: error calling TotalPages: runtime error: invalid memory address or nil pointer dereference

or

DEBUG 2019/05/17 08:53:26 creating alias: /blog/page/1/index.xml redirecting to http://localhost:1313/blog/
ERROR 2019/05/17 08:53:26 Failed to render "/blog/":

ERROR 2019/05/17 08:53:26 Failed to render pages: render of "section" failed: "/Users/cheribibi/Boulot/projets/tnd/freshebt/freshebt.com/layouts/article/list.html:12:21": execute of template failed: template: article/list.html:12:21: executing "main" at <$paginator.PageNumber>: error calling PageNumber: runtime error: invalid memory address or nil pointer dereference
DEBUG 2019/05/17 08:53:26 Render XML for "sitemapindex" to "sitemap.xml"
ERROR 2019/05/17 08:53:26 Failed to render "/partners/":

ERROR 2019/05/17 08:53:26 Logged 2 error(s)

I've tried wrapping every project's ref to Paginator's properties inside with statement, but the _internal/pagination template will still produce the error.

We put in place this repo where the problem will sysmetically happen after navigating the site on hugo serve: #5885 (comment)

Activity

  1. changed the title [-]Paginator invalid mem. nil pointer[/-] [+]Paginator invalid mem. nil pointer on Hugo server[/+] on May 17, 2019
  2. reopened this on May 17, 2019
  3. added a commit that references this issue on May 18, 2019
  4. added this to the v0.55.6 milestone on May 18, 2019
  5. added a commit that references this issue on May 18, 2019
    95ce2a4
  6. github-actions commented on Feb 18, 2022

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked as resolved and limited conversation to collaborators on Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions