An error occurs when closing the music bot - discord

I am currently developing a music bot using library pycord (Previously it was discord.py).
I sometimes get the following error when closing the music bot.
av_interleaved_write_frame(): Broken pipe
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:1: Broken pipe
Error writing trailer of pipe:1: Broken pipe
This error indicates that there is still a voice connection.
But it is designed to connect from the voice channel at the end. (Disconnecting with the cog_unload function of the music player Cog.)
Why does this error occur?

u need to do Disconnect the bot first from any voice channel before shutdowning its process or you can just ignore that error, that error willnot affect the bot because it was shutting down. thats is my oppinion, sorry if wrong spell or not helping answer

Related

web server returns "broken pipe" error when constantly reloading page

I found a partial solution for the last couple errors and what I did was just create a thread pool instead of creating new threads and killing them each connection. Now i don't have those weird errors but I am having a problem listed below.
I'm working on a C web server on my raspberry pi and i'm able to handle multiple web page requests but when the client decides to reload the page really fast, after a couple of reloads, the web server crashes and gdb gives me the error: "broken pipe".
Here's the code for the server: https://hastebin.com/wuzepotiko.c
I think the problem might be with the read error handling because when I use gdb it gives me the error:
Thread 13 "webServer" received signal SIGPIPE, Broken pipe.
[Switching to Thread 0xb161f440 (LWP 23260)]
__libc_write (nbytes=0, buf=0x22cc0 <httpResponse>, fd=7)
at ../sysdeps/unix/sysv/linux/write.c:26
26 ../sysdeps/unix/sysv/linux/write.c: No such file or directory.
I know it's a ton of code but I've been stuck on this for a while now. Even if someone could point me in the right direction I would really appreciate it!
I found an answer to the question. Since the write function was sending a broken pipe error to the kernel, which told the kernel to quit the process, i used the send function which allowed me to prevent signals being sent to the kernel and now it works! Thank you to everyone who helped me fix my problems!

How are messages marked as read using discord.js?

I've written a chat client extension for visual studio code, using the https://discord.js.org/ framework.
At the moment I'm tracking the last read message in each channel manually, but the message and channel objects have an 'acknowledge' method to mark them as read.
It seems that this should be the correct way to mark messages as read, but I can't work out how to determine which messages have been read when fetching the messages from the server?
There are no events or any sort of way to see if a message was read sadly. It is a feature that I would like implemented, but for the time being there is no way to do it.
Wishing you luck,
Zaedus

MQSUB ended with reason code 2429 in pub sub

I am using IBM WebSphere MQ to set up a durable subscription for Pub/Sub. I am using their C APIs. I have set up a subscription name and have MQSO_RESUME in my options.
When I set a wait interval for my subscriber and I properly close my subscriber, it works fine and restarts fine.
But if I force crash my subscriber (Ctrl-C) and I try to re open it, I get a MQSUB ended with reason code 2429 which is MQRC_SUBSCRIPTION_IN_USE.
I use MQWI_UNLIMITED as my WaitInterval in my MQGET and use MQGMO_WAIT | MQGMO_NO_SYNCPOINT | MQGMO_CONVERT as my MQGET options
This error pops up only when the topic has no pending messages for that subscription. If it has pending messages that the subscription can resume, then it resumes and it ignores the first published message in that topic
I tried changing the heartbeat interval to 2 seconds and that didn't fix it.
How do I prevent this?
This happens because the queue manager has not yet detected that your application has lost its connection to the queue manager. You can see this by issuing the following MQSC command:-
DISPLAY CONN(*) TYPE(ALL) ALL WHERE(APPLTYPE EQ USER)
and you will see your application still listed as connected. As soon as the queue manager notices that your process has gone you will be able to resume the subscription again. You don't say whether your connection is a locally bound connection or a client connection, but there are some tricks to help speed up the detection of connections depending on the type of connection.
You say that in the times when you are able to resume you don't get the first message, this is because you are retrieving this messages with MQGMO_NO_SYNCPOINT, and so that message you are not getting was removed from the queue and was on its way down the socket to the client application at the time you forcibly crashed it, and so that message is gone. If you use MQGMO_SYNCPOINT, (and MQCMIT) you will not have that issue.
You say that you don't see the problem when there are still messages on the queue to be processed, that you only see it when the queue is empty. I suspect the difference here is whether your application is in an MQGET-wait or processing a message when you forcibly crash it. Clearly, when there are no messages left on the queue, you are guarenteed with the use of MQWL_UNLIMITED, to be in the MQGET-wait, but when processing messages, you probably spend more time out of the MQGET than in it.
You mention tuning down the heartbeat interval, to try to reduce the time frame, this was a good idea. You said it didn't work. Please remember that you have to change it at both ends of the channel, or you will still be using the default 5 minutes.

Catch a forced exit from terminal (x button on top OR ctrl+Z)

im making a chat in C using TCP connection between client and server.
Im running that on linux terminal.
First of all i run the server on one terminal, and then every client on another one.
Everything is done except one thing.
I want that the client program will catch a click on the X button on the terminal or closing the program with CTRL+C ,and before the process die send a message to the server.
There is a way to do such thing?
Thank you, Dudu.
What you're looking for is to intercept a System Signal.
http://en.wikipedia.org/wiki/C_signal_handling

How to derect Errors via Soupsession or SoupMessage Signals?

Im currently developing with WebkitGtk+ Unstable Api
I'm using Soupsession Object to conect Signals and Rertve Soupmessages to (again)
hook signals to every Message to obtain time details of network events, my problem is how to monitor errors from this point.
if I'm using just the signal, there is a way to detect when a network error like DNS error or a socket error ocurrs i searched over the SoupSession Manuals but found nothing usable.
can someone give me some guidances?
Some time ago i figured it out.
the errors are reported in the responce http code of the soup message
https://developer.gnome.org/libsoup/stable/libsoup-2.4-soup-status.html
I just needed to capture the status code in the soup message signal "finished" to know if the resource failed (and why) or if was successful

Resources