-
Notifications
You must be signed in to change notification settings - Fork 435
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
FailureException: recvmsg EINVALStack: ConnectionError: recvmsg EINVAL - EINSTLOOKUP fails in Azure ASE v3 environment #1647
Comments
Hi @teresahoes-klf , thanks for the details on the issue. Have you tried enable the debug options like @dhensby mentioned under the mssql side issue? The debug options can provide more details on package contents and maybe more information on the error side. |
Hi @MichaelSun90 -- I did try putting in that environment variable to the web app, as well as setting it in the config "options": { but i dont get anything more in the stack trace for the error. where else might the extra detail show up? |
Not 100% sure how exactly mssql side works with the debug options, but I think it should be similar process. There was a recent change on how debug work, and we will be updating the doc soon. You can check for details here . However, in short you should be able to enable the debug by doing this:
there are some examples under the link that I posted for the test files. |
You should be able to load the There's also two different ways of asking for sql server instances, one is connecting directly to the ip address running the sql server browser component (this is what's implemented by There's also different messages being sent to the sql server browser component depending on how the message is being sent. The exact message details are described in It's really hard to guess what's going wrong. Because the SQLR protocol uses UDP, there's no way to understand whether sending a message worked, or whether there's some issue with the connection itself (Firewall rules etc). As you're mentioning that connections with |
so i did get debugging turned on and here is the output right before the failure ======================= |
I don't think that's anything to do with the SSL chain, it looks like a very low-level error, there's only one place in the tedious code that throws But that doesn't really help us get any closer :/ |
Just wanted to post an update in case anyone else runs across this problem. A colleague of mine was able to isolate this issue to outside the tedious driver - it seems to be specific to how the underlying environment fails to assign a dynamic port -- see below: The following code helps isolate the issue. The issue seems to be the call to server.bind passing in a value of 0 for port. According to the NODE docs: “If port is not specified or is 0, the operating system will attempt to bind to a random port”. However, on the Azure Function App it is not being assigned a random port number and is listening for responses on 0.0.0.0:0. On our Node Dev box the below code successfully works and displays:
On our Azure Function App environment it fails and displays:
HERE IS THE CODE: const util = require('util'); const dns = require('node:dns'); const dnsLookup = util.promisify(dns.lookup); const sqlServerHostname = 'xxxxxx.xxxxxx.com'; (async () => {
})() Therefore, the error isn't specific to the tedious driver, but seems to be an underlying node/Azure environment issue since the above code uses node calls only. |
@teresahoes-klf Thanks for sharing this. 👍 🙇 |
--cross posted to mssql - they suggested i post here as its tedious specific
tediousjs/node-mssql#1688
We recently had to upgrade our Azure ASE environment from v2 to v3. Since then our function apps and web apps that connect to SQL instances have been failing on the lookup to get the instance port. These calls all worked prior to the upgrade and work outside the ASE environment (i.e. running locally on a dev machine). We have been working with MS support but they have not been able to identify any network related issues. The communication between the azure function/webapp and the UDP port on the sql server happens (we have wire sharked), but for some reason the tedious driver doesn't understand what is returned or fails for some other reason. Since we can't debug in Azure we can't find any further detail on the error besides the stack trace noted below.
Note we did try using the sqlnodev8 driver and those calls DO work successfully so this is limited to the tedious driver.
I don't know if there is an updated needed to tedious driver or you have other suggestions on how to get this to work. Switching everything to the sqlnodev8 driver isn't a very good option for us.
Expected behaviour:
Instance lookup should work as expected.
Actual behaviour:
2024-08-06T22:27:17.924 [Error] Executed 'Functions.timer-xxx' (Failed, Id=95e49fde-6701-4227-8a19-fd2f40926d25, Duration=12ms)
Result: FailureException: recvmsg EINVAL
Stack: ConnectionError: recvmsg EINVAL
at C:\home\site\wwwroot\node_modules\mssql\lib\tedious\connection-pool.js:85:17
at Connection.onConnect (C:\home\site\wwwroot\node_modules\tedious\lib\connection.js:849:9)
at Object.onceWrapper (node:events:629:26)at Connection.emit (node:events:514:28)
at Connection.emit (C:\home\site\wwwroot\node_modules\tedious\lib\connection.js:970:18)
at C:\home\site\wwwroot\node_modules\tedious\lib\connection.js:1006:16
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Configuration:
Here is a very simple function that we can use to reproduce issue
const SerializeError = require('serialize-error');
const sql = require('mssql');
const sqlConfig = {
"user": "xxx",
"password": "xxx",
"server": "xxxx.company.com",
"database": "xxxx",
"connectionTimeout": 240000,
"requestTimeout": 600000,
"options": {
"encrypt": true,
"abortTransactionOnError": true,
"trustServerCertificate": true,
"instanceName": "QA"
}
}
module.exports = async function (context, timer) {
};
Software versions
NodeJS: 16x, 18x, 20 x
node-mssql: 10.0.2 , 11.01
SQL Server: 2016
`
The text was updated successfully, but these errors were encountered: