[BUG] No new connections being made on empty pool when maxSize is less than incrementSize
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, node.js
Línea de trabajo
Comienza en lib/Pool.js alrededor de las líneas 211-212 y reproduce el caso de un pool vacío con maxSize: 5, initialSize: 1 y el valor predeterminado de incrementSize. Verifica que el pool pueda crear una conexión de reemplazo después de nativeClose y de la disminución de poolSize cuando maxSize sea menor que incrementSize.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe your system
odbcPackage Version: 2.4.8- ODBC Driver: Progress OpenEdge ODBC Driver 8.0.0
- Database Name: OpenEdge
- Database Version: 11.7
- Database OS: Windows
- Node.js Version: 18.20.2
- Node.js OS: linux/amd64
Describe the bug
This bug is related to pooling.
On an initialized empty pool (with no active connections), if the incrementSize is larger than the maxSize, if no new connections are being created, no new connections can be created.
For example:
If there is only one connection in a pool and that single connection dies (i.e. the socket gets closed), the connection needs to be closed manually with nativeClose and poolSize needs to be decremented manually. We need to call nativeClose instead of close because close will just release that dead connection back into the pool without closing it.
In this state, no new connection can be made.
I discovered this with a pool maxSize of 5, initialSize of 1 and without defining the incrementSize (it defaults to 10).
Expected behavior
A new connection should be made on an empty pool regardless of the maxSize and incrementSize settings on the pool.
To Reproduce
- Connect to database using a pool with options
{ maxSize: 5, initialSize: 1, reuseConnections: true } - Force close the connection socket from on the database server
- Call nativeClose on the connection in the pool and decrement the poolSize
- Call connect on the pool to obtain a new connection.
Code
const query = async (query) => {
let odbcConnection = await connect()
for (let tries = 0; tries < maxNumberOfTries; tries++) {
try {
const res = await odbcConnection.query(query)
await odbcConnection.close()
return res
} catch (error) {
if (
error.odbcErrors?.[0]?.message ===
"[DataDirect][ODBC Progress OpenEdge Wire Protocol driver]Socket closed."
) {
await odbcConnection.nativeClose()
this.pool.poolSize--
odbcConnection = await connect()
}
}
}
throw new Error("Failed to query the database")
}
- The offending code:
I believe the issue stems from this if statement in /lib/Pool.js on line 211 and 212
https://github.com/IBM/node-odbc/blob/c1cbc136670c50a55813b391637fd465ea0f3e81/lib/Pool.js#L211
The main issue here is that it doesn't make sense for incrementSize to be less than maxSize, but the default incrementSize is 10, so any maxSize less than that can cause issues.
Maybe the best way to handle this would be set the default incrementSize to min(maxSize, 10), or change the logic in the if condition to handle this case.
- Lenguaje dominante
- JavaScript
- Estrellas
- 159
- Forks
- 92
- Merge medio
- 5 h 59 min
- PR fusionados (30 d)
- 3
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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de IBM/node-odbc
-
doc: how to run the testsAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
security
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
[Bug] Sybase ASE: Encoding issue (works in msnodesqlv8, fails in node-odbc with \x1A artifacts)Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Todos los issues de IBM/node-odbc
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
schmayterling/hibi#245 ·
Los mantenedores suelen responder en 1 día
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
vercel/ai#23304 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug package:vitest
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cloudflare/workers-sdk#16255 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Proxy and MCP URLs with an empty authority parse as a different hostPosiblemente ocupada @ericcaiwx-star la tomó hoy. Abiertoclawsweeper:bulk-filed clawsweeper:linked-pr-open clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
openclaw/openclaw-enterprise#2384 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Access-request approve silently discards the decider's note (decision_note written only on deny)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Uuriko/project-room#3378 ·
Los mantenedores suelen responder en 1 día