in mod, https requests stop working after a while.

Post Reply
salahzar
Member
Posts: 24
Joined: Sat Jul 22, 2017 23:10
GitHub: salahzar
IRC: salahzar

in mod, https requests stop working after a while.

by salahzar » Post

Env: Ubuntu 18.04, Minetest 5.4.1
==========================
Hi I have the following piece of code working at beginning but after a while giving errors:
Spoiler

Code: Select all

local function callWikipedia(search)
  if search then
    minetest.log("calling wikipedia with "..search)

    local url = vikidia.composeUrl %
      { site = vikidia.site,
        title = urlencode(search)
      }
    local handle = vikidia.api.fetch_async({url = url, timeout = 10})
    local result
    repeat
      result = vikidia.api.fetch_async_get(handle)
    until (result.completed)
    if(result.code~=200) then
      minetest.log("Not found")
      return ""
    end
    return result.data
end
It works on the server quite well for a while, but after a bit (maybe just when users exit the server and re-enter) it stop working and giving the following error
2021-11-24 14:44:24: [Server]: calling wikipedia with mucca
2021-11-24 14:44:25: ERROR[CurlFetch]: https://it.vikidia.org/w/api.php?format ... tles=mucca not found (SSL connect error) (response code 0)
2021-11-24 14:44:25: [Server]: Not found
I starts again working perfectly for some time if server reboots. Is there something I need to close for having the behaviour keep on working for long time?

salahzar
Member
Posts: 24
Joined: Sat Jul 22, 2017 23:10
GitHub: salahzar
IRC: salahzar

Re: in mod, https requests stop working after a while.

by salahzar » Post

I set up a php proxy launching the https, and leaving the minetest calling only this small http proxy. So far it seems it is working without problems, but this means that calling https from http request table is having a leak. Dont know if this is a lua leak or a minetest wrapper leak, or if I need to release some resources in some way when calling https.

Code: Select all

<?php
$get=$_GET["name"];
$url="https://it.vikidia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=".$_GET["name"];
//echo($url);
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
echo($output);
?>

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests