#1131 net.http.request keeps failing with "Operation already in progress"
Reporter
Abraham Przewodnik
Owner
MattJ
Created
Updated
Stars
★ (1)
Tags
Type-Defect
Priority-Medium
Status-Fixed
Abraham Przewodnik
on
What steps will reproduce the problem?
Inside a module I have the following code as part of the "message/offline/handle"-hook:
http.request("https://fcm.googleapis.com/fcm/send", {
headers = {
["Authorization"] = "key="..FCM_API_KEY;
["Content-Type"] = "application/json";
};
body = jsonBody;
}, function (resp, code, request)
module:log("debug", "FCM response: %s", resp);
module:log("debug", "FCM status %d", code);
end);
What is the expected output?
The module should log the server response
What do you see instead?
FCM response: Operation already in progress
FCM status 0
What version of the product are you using? On what operating system?
Prosody 0.10.0
Debian GNU/Linux 8 (jessie) – All Updates installed
Lua 5.1 – This is what the dependencies of the package say
# Lua module versions
lfs: LuaFileSystem 1.6.2
libevent: 2.0.21-stable
luaevent: 0.4.4
lxp: LuaExpat 1.3.0
socket: LuaSocket 3.0-rc1
ssl: 0.5.PR
Please provide any additional information below.
- This happens even if this is the first request to the server
- Rebooting the Server doesn't help
- FCM_API_KEY and jsonBody are both strings and set correctly
- As far as I know this error happens because client:connect in "prosody/net/server_select.lua" fails (@line 1004)
- If I modify "prosody/net/server_select.lua" to do the "wrapclient" anyways, the request succeeds
MattJ
on
Hi, thanks for the report!
This looks like an issue in net.server/LuaSocket that is triggered by the remote domain having multiple IP addresses in DNS. I checked, and fcm.googleapis.com sure does have a few.
I recently fixed the issue in trunk (main changeset https://hg.prosody.im/trunk/rev/2bd2e94a0496 ), but the changes are fairly extensive and it may not be feasible to safely backport them to 0.10.
Changes
owner MattJ
Abraham Przewodnik
on
Thank You for your quick response.
I installed prosody-trunk from Your repositories and now the https-request works fine.
MattJ
on
Thanks for the confirmation! Marking this as fixed.
What steps will reproduce the problem? Inside a module I have the following code as part of the "message/offline/handle"-hook: http.request("https://fcm.googleapis.com/fcm/send", { headers = { ["Authorization"] = "key="..FCM_API_KEY; ["Content-Type"] = "application/json"; }; body = jsonBody; }, function (resp, code, request) module:log("debug", "FCM response: %s", resp); module:log("debug", "FCM status %d", code); end); What is the expected output? The module should log the server response What do you see instead? FCM response: Operation already in progress FCM status 0 What version of the product are you using? On what operating system? Prosody 0.10.0 Debian GNU/Linux 8 (jessie) – All Updates installed Lua 5.1 – This is what the dependencies of the package say # Lua module versions lfs: LuaFileSystem 1.6.2 libevent: 2.0.21-stable luaevent: 0.4.4 lxp: LuaExpat 1.3.0 socket: LuaSocket 3.0-rc1 ssl: 0.5.PR Please provide any additional information below. - This happens even if this is the first request to the server - Rebooting the Server doesn't help - FCM_API_KEY and jsonBody are both strings and set correctly - As far as I know this error happens because client:connect in "prosody/net/server_select.lua" fails (@line 1004) - If I modify "prosody/net/server_select.lua" to do the "wrapclient" anyways, the request succeeds
Hi, thanks for the report! This looks like an issue in net.server/LuaSocket that is triggered by the remote domain having multiple IP addresses in DNS. I checked, and fcm.googleapis.com sure does have a few. I recently fixed the issue in trunk (main changeset https://hg.prosody.im/trunk/rev/2bd2e94a0496 ), but the changes are fairly extensive and it may not be feasible to safely backport them to 0.10.
ChangesThank You for your quick response. I installed prosody-trunk from Your repositories and now the https-request works fine.
Thanks for the confirmation! Marking this as fixed.
Changes