JohnXLivingston / peertube-plugin-livechat

GNU Affero General Public License v3.0
86 stars 26 forks source link

Error logs: [Bots] ModerationBot stderr: [Sepia] Error: connect ECONNREFUSED ::1:52800 #411

Closed Chocobozzz closed 2 weeks ago

Chocobozzz commented 3 weeks ago

Describe the bug

Error messages appear in the logs:

[Bots] ModerationBot stderr: [Sepia] Error: connect ECONNREFUSED ::1:52800 

To Reproduce Steps to reproduce the behavior:

  1. Run PeerTube with plugin installed

Expected behavior No error log

Server (please complete the following information):

Plugin diagnostic:

Diagnostic

    Starting tests: OK
    Browser: OK
    Backend connection: OK
    Test debug mode: OK
        Debug mode is OFF
    Webchat activated on videos: OK
        Chat will open automatically
        Displaying «open in new window» button
        Chat can be enabled on live videos.
    Builtin Prosody and ConverseJS: KO
        The working dir is: /var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody
        Prosody will run on port '52800'
        Prosody will use http://127.0.0.1:9000/plugins/livechat/10.0.2/router/api/ as base uri from api calls
        Prosody path will be '/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosodyAppImage/squashfs-root/AppRun'
        Prosody will be using the '/var/www/peertube/storage/plugins/node_modules/peertube-plugin-livechat/dist/server/prosody/livechat-prosody-x86_64.AppImage' AppImage
        Prosody AppImage extract path will be '/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosodyAppImage'
        Prosody modules path will be '/var/www/peertube/storage/plugins/node_modules/peertube-plugin-livechat/dist/server/prosody-modules'
        Prosody rooms will be grouped by 'video'.
        By default, room content will be archived.
        Room content will be saved for '1w'
        The prosody configuration file (/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/prosody.cfg.lua) exists
        Prosody configuration file content is correct.
        Pid file /var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/prosody.pid found
        Prosodyctl status: Prosody is running with PID 1405536
        The prosody configuration file (/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/prosody.cfg.lua) exists
        Prosody configuration file content is correct.
        No missing self signed certificates.
        Prosody version is 0.12.3
        Error when calling Prosody test api (test-peertube-prosody): RequestError: connect ECONNREFUSED ::1:52800

Additional debugging information
Current prosody configuration
daemonize = false;
allow_registration = false;
admins = {
};
prosody_user = "peertube";
pidfile = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/prosody.pid";
plugin_paths = {
  "/var/www/peertube/storage/plugins/node_modules/peertube-plugin-livechat/dist/server/prosody-modules";
};
data_path = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/data";
storage = "internal";
modules_enabled = {
  "roster";
  "saslauth";
  "carbons";
  "version";
  "uptime";
  "ping";
  "posix";
  "disco";
  "net_multiplex";
  "s2s";
  "tls";
  "s2s_peertubelivechat";
  "websocket_s2s_peertubelivechat";
};
modules_disabled = {
};
consider_bosh_secure = true;
consider_websocket_secure = true;
certificates = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/data";
c2s_require_encryption = false;
interfaces = {
  "127.0.0.1";
  "::1";
};
c2s_ports = {
};
c2s_interfaces = {
  "127.0.0.1";
  "::1";
};
s2s_ports = {
};
s2s_interfaces = {
};
ports = {
  "52800";
};
http_ports = {
};
http_interfaces = {
  "127.0.0.1";
  "::1";
};
https_ports = {
};
https_interfaces = {
  "127.0.0.1";
  "::1";
};
trusted_proxies = {
  "127.0.0.1";
  "::1";
};
c2s_close_timeout = 29;
s2s_secure_auth = false;
peertubelivechat_server_infos_path = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/serverInfos";
peertubelivechat_instance_url = "https://framatube.org";
websocket_s2s_ping_interval = 55;
s2s_peertubelivechat_no_outgoing_directs2s_to_peertube = true;
log = {
  info = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/prosody.log";
  error = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/prosody.err";

};

VirtualHost "framatube.org"
  authentication = "http";
  modules_enabled = {
  "ping";
  "http";
  "bosh";
  "websocket";
  "dialback";
  "vcard_peertubelivechat";
};
  http_auth_url = "http://127.0.0.1:9000/plugins/livechat/10.0.2/router/api/user";
  allow_anonymous_s2s = false;
  http_host = "framatube.org";
  http_external_url = "http://framatube.org";
  peertubelivechat_vcard_peertube_url = "http://127.0.0.1:9000";

VirtualHost "anon.framatube.org"
  authentication = "anonymous";
  modules_enabled = {
  "ping";
  "http";
  "bosh";
  "websocket";
  "random_vcard_peertubelivechat";
};
  modules_disabled = {
  "carbons";
};
  allow_anonymous_s2s = false;
  http_host = "framatube.org";
  http_external_url = "http://framatube.org";
  peertubelivechat_random_vcard_avatars_path = "/var/www/peertube/storage/plugins/node_modules/peertube-plugin-livechat/dist/server/avatars/sepia";
  peertubelivechat_random_vcard_avatars_files = {
  "0.png";
  "1.png";
  "10.png";
  "100.png";
  "101.png";
  "102.png";
  "103.png";
  "104.png";
  "105.png";
  "106.png";
  "107.png";
  "108.png";
  "109.png";
  "11.png";
  "110.png";
  "111.png";
  "112.png";
  "113.png";
  "114.png";
  "115.png";
  "116.png";
  "117.png";
  "118.png";
  "119.png";
  "12.png";
  "120.png";
  "121.png";
  "122.png";
  "123.png";
  "124.png";
  "125.png";
  "126.png";
  "127.png";
  "128.png";
  "129.png";
  "13.png";
  "130.png";
  "131.png";
  "132.png";
  "133.png";
  "134.png";
  "135.png";
  "136.png";
  "137.png";
  "138.png";
  "139.png";
  "14.png";
  "140.png";
  "141.png";
  "142.png";
  "143.png";
  "144.png";
  "145.png";
  "146.png";
  "147.png";
  "148.png";
  "149.png";
  "15.png";
  "150.png";
  "151.png";
  "152.png";
  "153.png";
  "154.png";
  "155.png";
  "156.png";
  "157.png";
  "158.png";
  "159.png";
  "16.png";
  "160.png";
  "161.png";
  "162.png";
  "163.png";
  "164.png";
  "165.png";
  "166.png";
  "167.png";
  "168.png";
  "169.png";
  "17.png";
  "170.png";
  "171.png";
  "172.png";
  "173.png";
  "174.png";
  "175.png";
  "176.png";
  "177.png";
  "178.png";
  "179.png";
  "18.png";
  "180.png";
  "181.png";
  "182.png";
  "183.png";
  "184.png";
  "185.png";
  "186.png";
  "187.png";
  "188.png";
  "189.png";
  "19.png";
  "190.png";
  "191.png";
  "192.png";
  "193.png";
  "194.png";
  "195.png";
  "196.png";
  "197.png";
  "198.png";
  "199.png";
  "2.png";
  "20.png";
  "21.png";
  "22.png";
  "23.png";
  "24.png";
  "25.png";
  "26.png";
  "27.png";
  "28.png";
  "29.png";
  "3.png";
  "30.png";
  "31.png";
  "32.png";
  "33.png";
  "34.png";
  "35.png";
  "36.png";
  "37.png";
  "38.png";
  "39.png";
  "4.png";
  "40.png";
  "41.png";
  "42.png";
  "43.png";
  "44.png";
  "45.png";
  "46.png";
  "47.png";
  "48.png";
  "49.png";
  "5.png";
  "50.png";
  "51.png";
  "52.png";
  "53.png";
  "54.png";
  "55.png";
  "56.png";
  "57.png";
  "58.png";
  "59.png";
  "6.png";
  "60.png";
  "61.png";
  "62.png";
  "63.png";
  "64.png";
  "65.png";
  "66.png";
  "67.png";
  "68.png";
  "69.png";
  "7.png";
  "70.png";
  "71.png";
  "72.png";
  "73.png";
  "74.png";
  "75.png";
  "76.png";
  "77.png";
  "78.png";
  "79.png";
  "8.png";
  "80.png";
  "81.png";
  "82.png";
  "83.png";
  "84.png";
  "85.png";
  "86.png";
  "87.png";
  "88.png";
  "89.png";
  "9.png";
  "90.png";
  "91.png";
  "92.png";
  "93.png";
  "94.png";
  "95.png";
  "96.png";
  "97.png";
  "98.png";
  "99.png";
};

VirtualHost "bot.framatube.org"
  modules_enabled = {
  "ping";
  "random_vcard_peertubelivechat";
};
  authentication = "peertubelivechat_bot";
  peertubelivechat_random_vcard_avatars_path = "/var/www/peertube/storage/plugins/node_modules/peertube-plugin-livechat/dist/server/bot_avatars/sepia";
  peertubelivechat_random_vcard_avatars_files = {
  "1.png";
};
  livechat_bot_conf_folder = "/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/bot/room.framatube.org";

Component "room.framatube.org" "muc"
  admins = {
  "moderator@bot.framatube.org";
};
  muc_room_locking = false;
  muc_tombstones = false;
  muc_room_default_language = "en";
  muc_room_default_public = false;
  muc_room_default_persistent = true;
  muc_room_default_members_only = false;
  muc_room_default_moderated = false;
  muc_room_default_public_jids = false;
  muc_room_default_change_subject = false;
  muc_room_default_history_length = 20;
  modules_enabled = {
  "muc_slow_mode";
  "pubsub_peertubelivechat";
  "muc_http_defaults";
  "websocket_s2s_peertubelivechat";
  "dialback";
  "muc_mam";
  "muc_moderation";
  "http_peertubelivechat_manage_rooms";
  "http_peertubelivechat_test";
};
  slow_mode_duration_form_position = {
  120;
};
  restrict_room_creation = false;
  http_host = "framatube.org";
  http_external_url = "http://framatube.org";
  muc_create_api_url = {
  "http://127.0.0.1:9000/plugins/livechat/10.0.2/router/api/room?apikey=***APIKey***&jid={room.jid|jid_node}";
};
  muc_log_by_default = true;
  muc_log_presences = true;
  log_all_rooms = false;
  muc_log_expires_after = "1w";
  muc_log_cleanup_interval = 14400;
  peertubelivechat_manage_rooms_apikey = "***APIKey***";
  peertubelivechat_test_apikey = "***APIKey***";
  peertubelivechat_test_peertube_api_url = "http://127.0.0.1:9000/plugins/livechat/10.0.2/router/api/test?apikey=***APIKey***";

Prosody version
Prosody 0.12.3

# Prosody directories
Data directory:     /var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody/data
Config directory:   /var/www/peertube/storage/plugins/data/peertube-plugin-livechat/prosody
Source directory:   /usr/lib/prosody
Plugin directories:
  /var/lib/prosody/custom_plugins - not a directory!
  /var/www/peertube/storage/plugins/node_modules/peertube-plugin-livechat/dist/server/prosody-modules
  /usr/lib/prosody/modules/

# Operating system
Linux 6.1.0-21-amd64    

# Lua environment
Lua version:                Lua 5.2

Lua module search paths:
  /usr/lib/prosody/?.lua
  /usr/local/share/lua/5.2/?.lua
  /usr/local/share/lua/5.2/?/init.lua
  /usr/local/lib/lua/5.2/?.lua
  /usr/local/lib/lua/5.2/?/init.lua
  /usr/share/lua/5.2/?.lua
  /usr/share/lua/5.2/?/init.lua
  /var/lib/prosody/custom_plugins/share/lua/5.2/?.lua
  /var/lib/prosody/custom_plugins/share/lua/5.2/?/init.lua

Lua C module search paths:
  /usr/lib/prosody/?.so
  /usr/local/lib/lua/5.2/?.so
  /usr/lib/x86_64-linux-gnu/lua/5.2/?.so
  /usr/lib/lua/5.2/?.so
  /usr/local/lib/lua/5.2/loadall.so

LuaRocks:           Not installed

# Network

Backend: epoll

# Lua module versions
LuaExpat:       1.3.0
LuaFileSystem:  1.8.0
LuaSec:         1.0
LuaSocket:      3.0-rc1
luaunbound:     0.5 (?)
readline:       2.7

# library versions
libcrypto:      OpenSSL 1.1.1n  15 Mar 2022
libunbound:     1.13.1

Additional context

I think you may want to use 127.0.0.1 instead of localhost here

JohnXLivingston commented 3 weeks ago

I'm not 100% that this is the issue. The diagnostic tool seems to point another issue. Have you another Peertube instance on the same server? If so, there are some ports to change in the plugin configuration. If not, can you check that there is no "prosody" process that was related to a previous peertube process, and that was not correctly killed? (i know this can happen in some case, but i did not find why yet).

Or maybe you don't have IPv6 on your server? (in this case, maybe your suggested fix is the correct one)

Chocobozzz commented 3 weeks ago

Have you another Peertube instance on the same server

No, it's the only instance

If not, can you check that there is no "prosody" process that was related to a previous peertube process, and that was not correctly killed? (i know this can happen in some case, but i did not find why yet).

Prosody ran by the livechat plugin is the only prosody process on the server

Or maybe you don't have IPv6 on your server?

The server has IPv6 enabled, and so localhost can be resolved in a IPv6 address. However prosody is listening on 127.0.0.1:52800

JohnXLivingston commented 3 weeks ago

The server has IPv6 enabled, and so localhost can be resolved in a IPv6 address. However prosody is listening on 127.0.0.1:52800

Prosody configuration listen on both ipv4 and 6. Here are some parts of your diagnostic result:

interfaces = {
  "127.0.0.1";
  "::1";
};
c2s_interfaces = {
  "127.0.0.1";
  "::1";
};
http_interfaces = {
  "127.0.0.1";
  "::1";
};
https_interfaces = {
  "127.0.0.1";
  "::1";
};
trusted_proxies = {
  "127.0.0.1";
  "::1";
};

What makes you think Prosody only listen on ipv4? Have you tried telnet ::1 52800?

JohnXLivingston commented 3 weeks ago

Maybe have you a firewall?

Chocobozzz commented 3 weeks ago

I checked using ss:

> % sudo ss -ltnp | grep 52800
LISTEN 0      128        127.0.0.1:52800      0.0.0.0:*    users:(("lua5.2",pid=1405536,fd=8)

I don't know why prosody doesn't listen on ::1 too :thinking: Maybe the ; should be ,? https://prosody.im/doc/ports#ports

telnet ::1 52800

Yes, I confirm it doesn't work. (telnet 127.0.0.1 52800 works)

JohnXLivingston commented 3 weeks ago

I don't know why prosody doesn't listen on ::1 too 🤔 Maybe the ; should be ,? https://prosody.im/doc/ports#ports

That's weird. Here is what i got on my server:

LISTEN 0      128        127.0.0.1:52800      0.0.0.0:*    users:(("lua5.2",pid=1228702,fd=12))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
LISTEN 0      128            [::1]:52800         [::]:*    users:(("lua5.2",pid=1228702,fd=13))        

And it's not the ,, ; is ok when multi line.

There are multiple location in my code where i use localhost. Before changing it, i would like to understand what's happening. (if i change it, and some people have ipv6 only servers, it could break the plugin for them...)

JohnXLivingston commented 3 weeks ago

Can we plan an online meeting, so i can debug it with you? Tomorrow?

JohnXLivingston commented 2 weeks ago

Issue was fixed by changing the port in the settings. Prosody had an error log that said that 52800 was already on use for ::1. But we don't understand why. Closing the issue.