smartcontractkit / smartcontractkit/chainlink

[NODE] adapter returning null in binary data results in data not saved to postgresql

Open
#6,549 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
8.2k
Forks
2k
Avg merge
1d 23h
Merged PRs (30d)
202

Description

Description

When an adapter returns null in binary data and the node attempts to save this data to the postgresql backend, the backend cannot save this data as text. This results in the display staying in the "running" state

Basic Information
api-adapter_1 | <Buffer a1 63 66 6f 6f 19 04 00> false
chainlink_1 | 2022-05-05T03:14:47.656Z [DEBUG] http adapter got 200 in 27.957026ms attempt=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest.HTTPRequest statusCode=200 taskName=fetch taskType=bridge timeElapsedSeconds=0.027957026
chainlink_1 | 2022-05-05T03:14:47.656Z [DEBUG] http adapter finished after 28.139121ms attempt=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest.HTTPRequest statusCode=200 taskName=fetch taskType=bridge timeElapsedSeconds=0.028139121
chainlink_1 | 2022-05-05T03:14:47.656Z [DEBUG] Bridge task: fetched answer chainlink_1 | 2022-05-05T03:14:47.656Z [DEBUG] Pipeline task completed attempt=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest resultTychainlink_1 | 2022-05-05T03:14:47.656Z [DEBUG] scheduling task run attempts=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa dot_id=encode_large externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest.Scheduler
chainlink_1 | 2022-05-05T03:14:47.657Z [DEBUG] Pipeline task completed attempt=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest resultType=string resultValue=0xe14dd1c7d3b4fe33083e80cd0336843a799663208d0575401c3802bd3c6aa98d00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000008a163666f6f190400000000000000000000000000000000000000000000000000 runInfo={"IsRetryable":false,"IsPending":false} taskName=encode_large taskType=ethabiencode
chainlink_1 | 2022-05-05T03:14:47.657Z [DEBUG] scheduling task run attempts=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa dot_id=encode_tx externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest.Scheduler
chainlink_1 | 2022-05-05T03:14:47.657Z [DEBUG] scheduling task run attempts=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa dot_id=submit_tx externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest.Scheduler
chainlink_1 | 2022-05-05T03:14:47.657Z [WARN] Global ENV var set MIN_OUTGOING_CONFIRMATIONS=2, overriding all other values for MinRequiredOutgoingConfirmations evmChainID=4 logger=1.4.0@a5f089f.EVM
chainlink_1 | 2022-05-05T03:14:47.665Z [DEBUG] Pipeline task completed attempt=0 contract=0x0Ad44D64eD0B7acE8C1C0611E72f12dF1Fe016fa externalJobID=fec63d92-d868-4a0a-a72d-56620d493e08 jobID=0 logger=1.4.0@a5f089f.DirectRequest.DirectRequest resultType= runInfo={"IsRetryable":false,"IsPending":true} taskName=submit_tx taskType=ethtx
chainlink_1 | 2022-05-05T03:14:47.665Z [DEBUG] Postgres event broadcaster: received notification channel=insert_on_eth_txes logger=1.4.0@a5f089f.EventBroadcaster payload=ba91600e60d351603d2e4be7615283d796f21567
postgres_1 | 2022-05-05 03:14:47.667 UTC [35] ERROR: unsupported Unicode escape sequence
postgres_1 | 2022-05-05 03:14:47.667 UTC [35] DETAIL: \u0000 cannot be converted to text.
postgres_1 | 2022-05-05 03:14:47.667 UTC [35] CONTEXT: JSON data, line 1: ...
postgres_1 | 2022-05-05 03:14:47.667 UTC [35] STATEMENT:
postgres_1 | INSERT INTO pipeline_task_runs (pipeline_run_id, id, type, index, output, error, dot_id, created_at, finished_at)
postgres_1 | VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9),($10, $11, $12, $13, $14, $15, $16, $17, $18),($19, $20, $21, $22, $23, $24, $25, $26, $27),($28, $29, $30, $31, $32, $33, $34, $35, $36),($37, $38, $39, $40, $41, $42, $43, $44, $45),($46, $47, $48, $49, $50, $51, $52, $53, $54)
postgres_1 | ON CONFLICT (pipeline_run_id, dot_id) DO UPDATE SET
postgres_1 | output = EXCLUDED.output, error = EXCLUDED.error, finished_at = EXCLUDED.finished_at
postgres_1 | RETURNING *;
postgres_1 |
chainlink_1 | 2022-05-05T03:14:47.667Z [ERROR] Error in transaction, rolling back: StoreRun: ERROR: unsupported Unicode escape sequence (SQLSTATE 22P05) logger=1.4.0@a5f089f
chainlink_1 | StoreRun
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pipeline.(*orm).StoreRun.func1
chainlink_1 | /chainlink/core/services/pipeline/orm.go:168
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pg.sqlxTransactionQ
chainlink_1 | /chainlink/core/services/pg/transaction.go:138
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pg.SqlxTransaction
chainlink_1 | /chainlink/core/services/pg/sqlx.go:50
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pg.Q.Transaction
chainlink_1 | /chainlink/core/services/pg/q.go:158
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pipeline.(*orm).StoreRun
chainlink_1 | /chainlink/core/services/pipeline/orm.go:103
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pipeline.(*runner).Run
chainlink_1 | /chainlink/core/services/pipeline/runner.go:525
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/directrequest.(*listener).handleOracleRequest
chainlink_1 | /chainlink/core/services/directrequest/delegate.go:343
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/directrequest.(*listener).handleReceivedLogs
chainlink_1 | /chainlink/core/services/directrequest/delegate.go:252
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/directrequest.(*listener).processOracleRequests
chainlink_1 | /chainlink/core/services/directrequest/delegate.go:206
chainlink_1 | runtime.goexit
chainlink_1 | /usr/local/go/src/runtime/asm_amd64.s:1571
chainlink_1 | error storing run for spec ID 29 state suspended outputs { false} errors [] finished_at {{0001-01-01 00:00:00 +0000 UTC false}}
chainlink_1 | github.com/smartcontractkit/chainlink/core/services/pipeline.(*runner).Run

  • Network: Rinkleby
  • Blockchain Client: [name and version of blockchain client e.g. Geth v1.9.6]
  • Go Version: v1.18
  • Operating System: Linux
  • Commit: a5f089fb069cd474581d4380f8fdb7aeff112203
  • Hosting Provider: self-host
  • Startup Command: docker run

Environment Variables

Steps to Reproduce

having adapter return binary data

Additional Information
[replace this line with any additional information you would like to provide, such as screenshots illustrating the issue]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/services/pipeline/orm.go at StoreRun, then follow the runner path shown in the stack trace. Reproduce the binary adapter result against PostgreSQL and inspect how the pipeline task output is stored. Done means the run can be persisted without the reported unsupported Unicode escape error and does not remain stuck in the running state.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.