Skip to content
New issue

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

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

Already on GitHub? # to your account

Retry without capabilities if parse fails #493

Closed
fantix opened this issue May 22, 2024 · 0 comments · Fixed by #500
Closed

Retry without capabilities if parse fails #493

fantix opened this issue May 22, 2024 · 0 comments · Fixed by #500
Assignees
Labels
bug Something isn't working

Comments

@fantix
Copy link
Member

fantix commented May 22, 2024

Describe the bug

If parse() raises a retriable error, we should always retry even if the capabilities is unknown.

Additional context

│ /home/maurice/Dropbox/Projects/banquet/canapes-backend/.venv/lib/python3.10/site-packages/edgedb │
│ /base_client.py:746 in _query                                                                    │
│                                                                                                  │
│   743 │   async def _query(self, query_context: abstract.QueryContext):                          │
│   744 │   │   con = await self._impl.acquire()                                                   │
│   745 │   │   try:                                                                               │
│ ❱ 746 │   │   │   return await con.raw_query(query_context)                                      │
│   747 │   │   finally:                                                                           │
│   748 │   │   │   await self._impl.release(con)                                                  │
│   749                                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │           con = <AsyncIOConnection [closed] 0x7981448260a0>                                  │ │
│ │ query_context = QueryContext(                                                                │ │
│ │                 │   query=QueryWithArgs(                                                     │ │
│ │                 │   ),                                                                       │ │
│ │                 │   cache=QueryCache(                                                        │ │
│ │                 │   │   codecs_registry=<edgedb.protocol.protocol.CodecsRegistry object at   │ │
│ │                 0x79815e893800>,                                                             │ │
│ │                 │   │   query_cache=<edgedb.protocol.protocol.QueryCodecsCache object at     │ │
│ │                 0x79815e894790>                                                              │ │
│ │                 │   ),                                                                       │ │
│ │                 │   query_options=QueryOptions(                                              │ │
│ │                 │   │   output_format=<OutputFormat.BINARY: 98>,                             │ │
│ │                 │   │   expect_one=True,                                                     │ │
│ │                 │   │   required_one=False                                                   │ │
│ │                 │   ),                                                                       │ │
│ │                 │   retry_options=<edgedb.options.RetryOptions object at 0x79815e938520>,    │ │
│ │                 │   state=<edgedb.options.State object at 0x79815e88b6c0>                    │ │
│ │                 )                                                                            │ │
│ │          self = <edgedb.asyncio_client.AsyncIOClient object at 0x79815e9b9580>               │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/maurice/Dropbox/Projects/banquet/canapes-backend/.venv/lib/python3.10/site-packages/edgedb │
│ /base_client.py:262 in raw_query                                                                 │
│                                                                                                  │
│   259 │   │   │   │   │   capabilities != 0                                                      │
│   260 │   │   │   │   │   and not isinstance(e, errors.TransactionConflictError)                 │
│   261 │   │   │   │   ):                                                                         │
│ ❱ 262 │   │   │   │   │   raise e                                                                │
│   263 │   │   │   │   rule = query_context.retry_options.get_rule_for_exception(e)               │
│   264 │   │   │   │   if i >= rule.attempts:                                                     │
│   265 │   │   │   │   │   raise e                                                                │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │          args = {                                                                            │ │
│ │                 │   'query': '        WITH\n          template_part := (SELECT               │ │
│ │                 TemplatePart\n                   '+418,                                      │ │
│ │                 │   'args': (),                                                              │ │
│ │                 │   'kwargs': {                                                              │ │
│ │                 │   },                                                                       │ │
│ │                 │   'reg': <edgedb.protocol.protocol.CodecsRegistry object at                │ │
│ │                 0x79815e893800>,                                                             │ │
│ │                 │   'qc': <edgedb.protocol.protocol.QueryCodecsCache object at               │ │
│ │                 0x79815e894790>,                                                             │ │
│ │                 │   'output_format': <OutputFormat.BINARY: 98>,                              │ │
│ │                 │   'expect_one': True,                                                      │ │
│ │                 │   'required_one': False,                                                   │ │
│ │                 │   'allow_capabilities': <Capability.EXECUTE: 18446744073709551609>,        │ │
│ │                 │   'state': {}                                                              │ │
│ │                 }                                                                            │ │
│ │    cache_item = None                                                                         │ │
│ │  capabilities = None                                                                         │ │
│ │             i = 1                                                                            │ │
│ │ query_context = QueryContext(                                                                │ │
│ │                 │   query=QueryWithArgs(                                                     │ │
│ │                 │   │   query='        WITH\n          template_part := (SELECT              │ │
│ │                 TemplatePart\n                   '+418,                                      │ │
│ │                 │   │   args=(),                                                             │ │
│ │                 │   │   kwargs={                                                             │ │
│ │                 │   │   }                                                                    │ │
│ │                 │   ),                                                                       │ │
│ │                 │   cache=QueryCache(                                                        │ │
│ │                 │   │   codecs_registry=<edgedb.protocol.protocol.CodecsRegistry object at   │ │
│ │                 0x79815e893800>,                                                             │ │
│ │                 │   │   query_cache=<edgedb.protocol.protocol.QueryCodecsCache object at     │ │
│ │                 0x79815e894790>                                                              │ │
│ │                 │   ),                                                                       │ │
│ │                 │   query_options=QueryOptions(                                              │ │
│ │                 │   │   output_format=<OutputFormat.BINARY: 98>,                             │ │
│ │                 │   │   expect_one=True,                                                     │ │
│ │                 │   │   required_one=False                                                   │ │
│ │                 │   ),                                                                       │ │
│ │                 │   retry_options=<edgedb.options.RetryOptions object at 0x79815e938520>,    │ │
│ │                 │   state=<edgedb.options.State object at 0x79815e88b6c0>                    │ │
│ │                 )                                                                            │ │
│ │     reconnect = False                                                                        │ │
│ │          self = <AsyncIOConnection [closed] 0x7981448260a0>                                  │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/maurice/Dropbox/Projects/banquet/canapes-backend/.venv/lib/python3.10/site-packages/edgedb │
│ /base_client.py:238 in raw_query                                                                 │
│                                                                                                  │
│   235 │   │   │   │   │   │   **args                                                             │
│   236 │   │   │   │   │   )                                                                      │
│   237 │   │   │   │   else:                                                                      │
│ ❱ 238 │   │   │   │   │   return await self._protocol.query(**args)                              │
│   239 │   │   │   except errors.EdgeDBError as e:                                                │
│   240 │   │   │   │   if query_context.retry_options is None:                                    │
│   241 │   │   │   │   │   raise                                                                  │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │          args = {                                                                            │ │
│ │                 │   'query': '        WITH\n          template_part := (SELECT               │ │
│ │                 TemplatePart\n                   '+418,                                      │ │
│ │                 │   'args': (),                                                              │ │
│ │                 │   'kwargs': {                                                              │ │
│ │                 │   },                                                                       │ │
│ │                 │   'reg': <edgedb.protocol.protocol.CodecsRegistry object at                │ │
│ │                 0x79815e893800>,                                                             │ │
│ │                 │   'qc': <edgedb.protocol.protocol.QueryCodecsCache object at               │ │
│ │                 0x79815e894790>,                                                             │ │
│ │                 │   'output_format': <OutputFormat.BINARY: 98>,                              │ │
│ │                 │   'expect_one': True,                                                      │ │
│ │                 │   'required_one': False,                                                   │ │
│ │                 │   'allow_capabilities': <Capability.EXECUTE: 18446744073709551609>,        │ │
│ │                 │   'state': {}                                                              │ │
│ │                 }                                                                            │ │
│ │    cache_item = None                                                                         │ │
│ │  capabilities = None                                                                         │ │
│ │             i = 1                                                                            │ │
│ │ query_context = QueryContext(                                                                │ │
│ │                 │   query=QueryWithArgs(                                                     │ │
│ │                 │   │   query='        WITH\n          template_part := (SELECT              │ │
│ │                 TemplatePart\n                   '+418,                                      │ │
│ │                 │   │   args=(),                                                             │ │
│ │                 │   │   kwargs={                                                             │ │
│ │                 │   │   }                                                                    │ │
│ │                 │   ),                                                                       │ │
│ │                 │   cache=QueryCache(                                                        │ │
│ │                 │   │   codecs_registry=<edgedb.protocol.protocol.CodecsRegistry object at   │ │
│ │                 0x79815e893800>,                                                             │ │
│ │                 │   │   query_cache=<edgedb.protocol.protocol.QueryCodecsCache object at     │ │
│ │                 0x79815e894790>                                                              │ │
│ │                 │   ),                                                                       │ │
│ │                 │   query_options=QueryOptions(                                              │ │
│ │                 │   │   output_format=<OutputFormat.BINARY: 98>,                             │ │
│ │                 │   │   expect_one=True,                                                     │ │
│ │                 │   │   required_one=False                                                   │ │
│ │                 │   ),                                                                       │ │
│ │                 │   retry_options=<edgedb.options.RetryOptions object at 0x79815e938520>,    │ │
│ │                 │   state=<edgedb.options.State object at 0x79815e88b6c0>                    │ │
│ │                 )                                                                            │ │
│ │     reconnect = False                                                                        │ │
│ │          self = <AsyncIOConnection [closed] 0x7981448260a0>                                  │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ in query:594                                                                                     │
│                                                                                                  │
│ in execute:528                                                                                   │
│                                                                                                  │
│ in _parse:295                                                                                    │
│                                                                                                  │
│ in wait_for_message:61                                                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ClientConnectionClosedError
@fantix fantix added the bug Something isn't working label May 22, 2024
@fantix fantix self-assigned this May 22, 2024
fantix added a commit that referenced this issue Jun 19, 2024
New Features
============

* Support EdgeDB 5.0 "branch" connection option
  (by @vpetrovykh in #484 #485 #487)

* Support EdgeDB 5.0 AI extension
  (by @fantix in #489 #490)

Breaking Changes
================

* Enum values can now compare to user-defined enums successfully (#425)
  (by @fantix in bb7522c for #419)

* Add optional default to codegen params (#426)
  (by @fantix in 21b024a for #422)

Changes
=======

* blocking client: fix connect and timeout, support IPv6 (#499)
  (by @fantix @zachary822 in 28a83fd for #486)

Fixes
=====

* Add test to check setting a computed global using with_globals. (#494)
  (by @dnwpark in 636bc0e for #494)

* Fix test and add Python 3.12 in CI
  (by @fantix in #498 #503)

* Use result of pydantic_dataclass, will silence linters (#501)
  (by @AdrienPensart in d88187a)

* Extract ExecuteContext as in/out argument (#500)
  (by @fantix in 2fb7965 for #493)
fantix added a commit that referenced this issue Jun 19, 2024
New Features
============

* Support EdgeDB 5.0 "branch" connection option
  (by @vpetrovykh in #484 #485 #487)

* Support EdgeDB 5.0 AI extension
  (by @fantix in #489 #490)

Breaking Changes
================

* Enum values can now compare to user-defined enums successfully (#425)
  (by @fantix in bb7522c for #419)

* Add optional default to codegen params (#426)
  (by @fantix in 21b024a for #422)

Changes
=======

* blocking client: fix connect and timeout, support IPv6 (#499)
  (by @fantix @zachary822 in 28a83fd for #486)

Fixes
=====

* Add test to check setting a computed global using with_globals. (#494)
  (by @dnwpark in 636bc0e for #494)

* Fix test and add Python 3.12 in CI
  (by @fantix in #498 #503)

* Use result of pydantic_dataclass, will silence linters (#501)
  (by @AdrienPensart in d88187a)

* Extract ExecuteContext as in/out argument (#500)
  (by @fantix in 2fb7965 for #493)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant