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

AttributeError: 'NoneType' object has no attribute 'tzinfo' #2258

Closed
sentry-io bot opened this issue Nov 28, 2023 · 1 comment · Fixed by #2335
Closed

AttributeError: 'NoneType' object has no attribute 'tzinfo' #2258

sentry-io bot opened this issue Nov 28, 2023 · 1 comment · Fixed by #2335
Assignees
Labels
area/general Related to whole service, not a specific part/integration. complexity/single-task Regular task, should be done within days. gain/low This doesn't bring that much value to users. impact/high This issue impacts multiple/lot of users. kind/bug Something isn't working.

Comments

@sentry-io
Copy link

sentry-io bot commented Nov 28, 2023

Sentry Issue: PCKT-002-PACKIT-SERVICE-6CJ

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  File "copr/v3/requests.py", line 123, in handle_errors
    response_json = response.json()
  File "requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())

CoprTimeoutException: Gateway Timeout
Consider using pagination for large queries.
(3 additional frame(s) were not displayed)
...
  File "copr/v3/proxies/build.py", line 328, in create_from_custom
    return self._create(endpoint, data, buildopts=buildopts)
  File "copr/v3/helpers.py", line 73, in wrapper
    result = func(*args, **kwargs)
  File "copr/v3/proxies/build.py", line 340, in _create
    response = self.request.send(
  File "copr/v3/requests.py", line 46, in send
    handle_errors(response)
  File "copr/v3/requests.py", line 146, in handle_errors
    raise CoprTimeoutException(message, response=response)

AttributeError: 'NoneType' object has no attribute 'tzinfo'
(9 additional frame(s) were not displayed)
...
  File "packit_service/worker/helpers/build/copr_build.py", line 704, in handle_build_submit_error
    self.monitor_not_submitted_copr_builds(
  File "packit_service/worker/helpers/build/copr_build.py", line 397, in monitor_not_submitted_copr_builds
    time = elapsed_seconds(
  File "packit_service/utils.py", line 184, in elapsed_seconds
    begin = get_timezone_aware_datetime(begin)
  File "packit_service/utils.py", line 171, in get_timezone_aware_datetime
    if is_timezone_naive_datetime(datetime_to_update):
  File "packit_service/utils.py", line 156, in is_timezone_naive_datetime
    datetime_to_check.tzinfo is None

It looks like task_accepted_time can be None:

time = elapsed_seconds(
begin=self.metadata.task_accepted_time, end=datetime.now(timezone.utc)
)

Copy link
Author

sentry-io bot commented Nov 29, 2023

Sentry issue: PCKT-002-PACKIT-SERVICE-6RR

@majamassarini majamassarini added kind/bug Something isn't working. complexity/single-task Regular task, should be done within days. impact/high This issue impacts multiple/lot of users. area/general Related to whole service, not a specific part/integration. gain/low This doesn't bring that much value to users. labels Nov 30, 2023
@majamassarini majamassarini moved this from new to backlog in Packit Kanban Board Nov 30, 2023
@lachmanfrantisek lachmanfrantisek moved this from backlog to priority-backlog in Packit Kanban Board Jan 25, 2024
@mfocko mfocko self-assigned this Jan 28, 2024
mfocko added a commit to mfocko/packit-service that referenced this issue Feb 7, 2024
When submitting failed Copr builds to the Pushgateway, we're using time
of accepting the task, in some cases we don't have time of accepting, so
use ‹created_at› as a fallback.

Fixes packit#2258

Signed-off-by: Matej Focko <[email protected]>
@mfocko mfocko moved this from priority-backlog to in-review in Packit Kanban Board Feb 7, 2024
mfocko added a commit to mfocko/packit-service that referenced this issue Feb 11, 2024
When submitting failed Copr builds to the Pushgateway, we're using time
of accepting the task, in some cases we don't have time of accepting, so
use ‹created_at› as a fallback.

Fixes packit#2258

Signed-off-by: Matej Focko <[email protected]>
softwarefactory-project-zuul bot added a commit that referenced this issue Feb 11, 2024
fix(event): use fallback for accepted time

When submitting failed Copr builds to the Pushgateway, we're using time of accepting the task, in some cases we don't have time of accepting, so use ‹created_at› as a fallback.
Fixes #2258

Not sure about this change, since for the last occurrence in Sentry the difference between the reported time of failure and created_at is 5 minutes. I can the ‹task_accepted_time› only in DB, but this is happening even before the build starts, cause it's coming from an issue caused by submitting the build, so I would say that we should use the datetime.now()? But OTOH it doesn't feel like it's skipping the Celere queue and being handled right away.

Reviewed-by: Maja Massarini
@github-project-automation github-project-automation bot moved this from in-review to done in Packit Kanban Board Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/general Related to whole service, not a specific part/integration. complexity/single-task Regular task, should be done within days. gain/low This doesn't bring that much value to users. impact/high This issue impacts multiple/lot of users. kind/bug Something isn't working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants