Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jinja2.exceptions package_count error in catalog-web log review #4530

Open
FuhuXia opened this issue Nov 15, 2023 · 8 comments
Open

jinja2.exceptions package_count error in catalog-web log review #4530

FuhuXia opened this issue Nov 15, 2023 · 8 comments
Assignees
Labels
bug Software defect or bug CKAN 2.11 Issues addressed by CKAN 2.11 O&M Operations and maintenance tasks for the Data.gov platform

Comments

@FuhuXia
Copy link
Member

FuhuXia commented Nov 15, 2023

During the recent NewRelic log review, more than 50% of catalog-web errors is this

File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/templates/snippets/organization.html", line 52, in block 'inner'
{% block nums %}
File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/templates/snippets/organization.html", line 60, in block 'nums'
<dd>{{ h.SI_number_span(organization.package_count) }}</dd>
File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/lib/helpers.py", line 2391, in SI_number_span
number = int(number)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'package_count'

Sketch

Either fix it, or update the NR rule to ignore it.

@FuhuXia FuhuXia added the bug Software defect or bug label Nov 15, 2023
@hkdctol hkdctol added the O&M Operations and maintenance tasks for the Data.gov platform label Nov 16, 2023
@hkdctol hkdctol moved this to 📔 Product Backlog in data.gov team board Nov 16, 2023
@btylerburton btylerburton moved this from 📔 Product Backlog to 📥 Queue in data.gov team board Oct 10, 2024
@btylerburton btylerburton self-assigned this Nov 22, 2024
@btylerburton
Copy link
Contributor

To reproduce, add a ?q=" to the end of a query within an organization, such as:

https://catalog.data.gov/organization/gsa-gov?q=%22

This does not affect dataset queries such as:

https://catalog.data.gov/dataset?q=%22

At the moment, we're trying to determine if this affects a vanilla CKAN install of 2.10.5.

If yes, we will pursue filing a bug with upstream as this would be a core problem.

If no, then we will attempt to patch this in our own code.

Note that querying SOLR directly with a single double quote will also cause the error "

@btylerburton
Copy link
Contributor

The error from the SOLR query:


  "responseHeader":{
    "status":400,
    "QTime":0,
    "params":{
      "q":"\"",
      "indent":"true",
      "q.op":"OR",
      "_":"1733177831707"}},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.parser.TokenMgrError"],
    "msg":"org.apache.solr.search.SyntaxError: Cannot parse '\"': Lexical error at line 1, column 2.  Encountered: <EOF> after : \"\"",
    "code":400}}

@FuhuXia
Copy link
Member Author

FuhuXia commented Dec 3, 2024

Confirmed a vanilla CKAN 2.10.5. also has this issue.

@btylerburton
Copy link
Contributor

Confirmed a vanilla CKAN 2.10.5. also has this issue.

Given the above, I propose we punt on this issue and start focusing on getting us onto 2.11 which @FuhuXia has tested and confirmed it doesn't have this issue.

Also, since it's a core bug I will post an issue to ckan and see where that leads.

@FuhuXia
Copy link
Member Author

FuhuXia commented Dec 3, 2024

We can set some rules in the NewRelic to ignore this kind of messages from the weekly review.

@btylerburton
Copy link
Contributor

CKAN issue logged here: ckan/ckan#8562

@btylerburton
Copy link
Contributor

We can set some rules in the NewRelic to ignore this kind of messages from the weekly review.

I'm not so sure. A single instance of this error writes 147 logs to NR...

Screenshot 2024-12-03 at 11 12 43 AM

@btylerburton btylerburton moved this from 🏗 In Progress [8] to 📡 Blocked in data.gov team board Dec 3, 2024
@btylerburton
Copy link
Contributor

Blocked by #4860

@btylerburton btylerburton added the CKAN 2.11 Issues addressed by CKAN 2.11 label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Software defect or bug CKAN 2.11 Issues addressed by CKAN 2.11 O&M Operations and maintenance tasks for the Data.gov platform
Projects
Status: 📡 Blocked
Development

No branches or pull requests

3 participants