Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

diff, changelog and breaking overflow the stack on a spec with a callback cycle

Abierto
#1,257 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
tooling

Línea de trabajo

Start from the recursion path named in the issue: getCallbacksDiff → getCallbackDiff → getPathsDiff, and find where operations reach their callbacks again. Read the existing schema-diff cycle guard that keys on pairs of schema values, since the fix should mirror that pattern for callback (or path-item) pairs. Reproduce with oasdiff diff cb1.yaml cb1.yaml using the two yaml files from the payload; done means the four commands run to completion with no stack overflow and comparing a spec to itself yields no diff, plus a regression test.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

A spec whose callbacks form a cycle crashes oasdiff with fatal error: stack overflow. An operation carries a callback, the callback holds a path item, and that path item's operation carries the same callback, so the recursion never ends. The spec loads without complaint, so nothing warns the user before the crash.

This is independent of #1252 and predates it: the schema cycle guard applies to pairs of schemas, and the callback recursion has none.

Reproduce

cb1.yaml:

openapi: 3.0.3
info:
  title: callback cycle
  version: "1"
paths:
  /x:
    post:
      description: before
      responses:
        '200':
          description: ok
      callbacks:
        cb:
          $ref: '#/components/callbacks/cb'
components:
  callbacks:
    cb:
      '{$request.body#/u}':
        post:
          description: inner before
          responses:
            '200':
              description: ok
          callbacks:
            cb:
              $ref: '#/components/callbacks/cb'

cb2.yaml is the same file with before replaced by after.

oasdiff diff cb1.yaml cb2.yaml

Comparing the file with itself (oasdiff diff cb1.yaml cb1.yaml) crashes the same way, so a change is not needed to trigger it.

Observed

Command Result
diff, changelog, breaking, summary fatal error: stack overflow, exit code 2
validate, flatten (single spec) no output, still running after 25s

Every version tested behaves the same: v1.31.0, v1.32.0, v1.32.1 and v1.33.0-rc.1.

Where it comes from

The recursion runs through getCallbacksDiff to getCallbackDiff, which turns the callback into paths and calls getPathsDiff, which reaches the operations and their callbacks again. Nothing records which callback or path item is already being compared, so a cycle repeats forever. The guard that handles recursive schemas lives in the schema diff and keys on pairs of schema values, which this path never reaches.

Suggested direction

Guard the callback recursion the way schema pairs are guarded: record the pair of callbacks (or of path items) being compared and return no diff when the same pair is reached again while it is still in progress. Worth checking at the same time whether any other structure can recurse, for example a $ref between path items.

Reported from a review of the cyclic-schema work; the repro is synthetic, not from a user's spec.

Lenguaje dominante
Go
Estrellas
1.4k
Forks
109
Merge medio
9 h 35 min
PR fusionados (30 d)
31

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oasdiff/oasdiff

Todos los issues de oasdiff/oasdiff

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.