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

Error saving transaction - missing trace? #230

Open
mikeshultz opened this issue Nov 7, 2022 · 0 comments
Open

Error saving transaction - missing trace? #230

mikeshultz opened this issue Nov 7, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@mikeshultz
Copy link
Member

Just saw this in the logs. Don't really have the time to dig into it, but seems that for whatever reason, analytics failed to fetch a trace and because of that could not save the tx to the DB. Here's the logs:

ERROR 2022-11-07 22:05:04,214 django.request Internal Server Error: /fetch
Traceback (most recent call last):
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/query.py", line 928, in get_or_create      return self.get(**kwargs), False
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/query.py", line 650, in get      raise self.model.DoesNotExist(  core.models.Transaction.DoesNotExist: Transaction matching query does not exist.
During handling of the above exception, another exception occurred:
DETAIL:  Failing row contains (0xed3d8a5efb29d308bb5311466fc002ac1ae7a5c28fe4a90bff6af13498a5e4..., 15921012, 2022-11-07 22:04:11+00, , {"r": "0x701ab6c82379de57082e9608fdca8ba2e5943756464cec6bc3e2529..., null, {"to": "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86", "from": "0x..., [], 0x5646319e484099377e3d0484829c49818b1c4366, 0x2a8e1e676ec238d8a992307b495b45b3feaa5e86).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner      response = get_response(request)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback      return callback(request, *args, **kwargs)
    File "/srv/core/views.py", line 199, in fetch_transactions      refresh_transactions(latest - 2)
    File "/srv/core/blockchain/harvest/__init__.py", line 19, in refresh_transactions      ensure_latest_logs(block_number)
    File "/srv/core/blockchain/harvest/transactions.py", line 288, in ensure_latest_logs      ensure_latest_logs_for_contract(contract, pointers, upto)
    File "/srv/core/blockchain/harvest/transactions.py", line 301, in ensure_latest_logs_for_contract      download_logs_from_contract(contract, start_block, end_block)
    File "/srv/core/blockchain/harvest/transactions.py", line 280, in download_logs_from_contract      ensure_transaction_and_downsteam_hashes(list(tx_hashes))
    File "/srv/core/blockchain/harvest/transactions.py", line 234, in ensure_transaction_and_downsteam_hashes      ensure_transaction_and_downstream(tx_hash)
    File "/srv/core/blockchain/harvest/transactions.py", line 168, in ensure_transaction_and_downstream      db_tx, created = Transaction.objects.get_or_create(
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method      return getattr(self.get_queryset(), name)(*args, **kwargs)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/query.py", line 935, in get_or_create      return self.create(**params), True
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/query.py", line 671, in create      obj.save(force_insert=True, using=self.db)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/base.py", line 831, in save      self.save_base(
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/base.py", line 882, in save_base      updated = self._save_table(
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/base.py", line 1025, in _save_table      results = self._do_insert(
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/base.py", line 1066, in _do_insert      return manager._insert(
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method      return getattr(self.get_queryset(), name)(*args, **kwargs)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/query.py", line 1790, in _insert      return query.get_compiler(using=using).execute_sql(returning_fields)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1657, in execute_sql      cursor.execute(sql, params)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/sentry_sdk/integrations/django/__init__.py", line 562, in execute      return real_execute(self, sql, params)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute      return self._execute_with_wrappers(
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers      return executor(sql, params, many, context)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute      return self.cursor.execute(sql, params)
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__      raise dj_exc_value.with_traceback(traceback) from exc_value
    File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute      return self.cursor.execute(sql, params)  django.db.utils.IntegrityError: null value in column "debug_data" violates not-null constraint
DETAIL:  Failing row contains (0xed3d8a5efb29d308bb5311466fc002ac1ae7a5c28fe4a90bff6af13498a5e4..., 15921012, 2022-11-07 22:04:11+00, , {"r": "0x701ab6c82379de57082e9608fdca8ba2e5943756464cec6bc3e2529..., null, {"to": "0x2a8e1e676ec238d8a992307b495b45b3feaa5e86", "from": "0x..., [], 0x5646319e484099377e3d0484829c49818b1c4366, 0x2a8e1e676ec238d8a992307b495b45b3feaa5e86).

Failing in here:

debug = debug_trace_transaction(tx_hash)
internal_transactions = get_internal_transactions(tx_hash)
block_number = int(raw_transaction["blockNumber"], 16)
block = ensure_block(block_number)
params = {
"block_number": block_number,
"block_time": block.block_time,
"data": raw_transaction,
"receipt_data": receipt,
"debug_data": debug,
"internal_transactions": internal_transactions,
"from_address": receipt["from"],
"to_address": receipt.get("to"),
}
db_tx, created = Transaction.objects.get_or_create(
tx_hash=tx_hash, defaults=params
)

@mikeshultz mikeshultz added the bug Something isn't working label Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant