Giter Club home page Giter Club logo

Comments (12)

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024

Hello!
Yes, this piece of code starts a new python process that will only be used to play music on a specific server, but to be honest, I didn't thought that many process could start delaying the instantiation, so help me with some information.

How many servers/bot instances are will trying to execute before this delay starts to apper?
What do you mean by a bot that required too many shards?

As a result, the song cannot be played.
Is there a error being throwed in this situation? If yes, can you show me a screenshot?

from vulkan.

kimjunsung04 avatar kimjunsung04 commented on June 4, 2024

How many servers/bot instances are will trying to execute before this delay starts to apper?

  • The bot I tested has about 36,000 participating servers.
  • The number of instances is one.
    I think it is one because the delay started while creating an instance when the play command was used immediately after loading the bot.
  • My bot had 37 shards.

What do you mean by a bot that required too many shards?

  • I'm not good at English, so I think I used the wrong expression.
    Bots with about 5 shards are likely to have the same problem.

As a result, the song cannot be played.
Is there a error being throwed in this situation? If yes, can you show me a screenshot?

  • As shown in the screenshot below, the message 'NoneType' object has no attribute 'connect' is displayed.
    The cause of this is identified as a problem with trying to connect before the instant load is complete.
    However, I don't think waiting for instant load to complete is a solution to the problem.

image

from vulkan.

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024
  • My bot had 37 shards.
    Actually i didn't knew what is a shard, but then i look up and found this link and now i think that i get what you are saying.

Well, first of all, the whole Vulkan revolves around multiprocessing and having a Python process just to play the music, so that the music playback doesn't soffer when many requets come from Discord.
But for that, i needed to create a new instance of the bot itself, so this function came about

bot = initializer.getBot()
await bot.startBotCoro(self.__loop)
await self.__ensureDiscordConnection(bot)

For bots without shards the connection was always established before the VCommandsType.Play got to the Player Process and it always worked, but in your case it's not working. A simple solution that could "fix" this, is to put some sort of wait on line 260 below and wait for the bot connection to establish.

def __commandsReceiver(self) -> None:
while True:
command: VCommands = self.__queueReceive.get()
type = command.getType()
args = command.getArgs()

I have already patched this in this commit

But as you pointed out, it's not a real fix because there might be a huge delay to create this instance. However, any other solution would completely change the way Vulkan handles multiprocessing, and that takes a fair amount of time and effort.
If possible, try this solution and see if this fix is ​​working for you, let me know any updates!

Thanks for reporting this issue! :)

from vulkan.

kimjunsung04 avatar kimjunsung04 commented on June 4, 2024

Thank you for your kind reply!
As expected, the problem of not playing is solved, but it seems that it will take some time to load.
However, since it is executed once per server, I think that it can be used to some extent if the uptime is maintained well!
I'll leave a reply after checking if it worked.
thank you!

from vulkan.

kimjunsung04 avatar kimjunsung04 commented on June 4, 2024

As a result, it was not effective for me.
It took about 5 minutes to bring in sharding, so I thought it was too much.

I'm looking at the following two things in different ways.

  • Bring only certain shards
  • Replication of the main process

I will continue to find a way and I will inform you if you find a solution.
If you know how to solve it, you would be grateful if you share it.
Thank you for your help!

from vulkan.

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024

In the following days I'll work in a Vulkan version to allow you to choose when the Bot should start a new process to play the song or when it should start the song playback in the same process, which will fix your delay problem.

from vulkan.

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024

Hello!
As a result of many hours of work, I patched this in this PR #37, take a look of what has changed and how to set up the project for your usage.
Thanks for the report!
If you had any questions, just let me know!

from vulkan.

kimjunsung04 avatar kimjunsung04 commented on June 4, 2024

Oh! Thank you!
I tried the updated code right away.
However, a connection-related error occurred.

[ERROR CONNECTING TO VC] -> 'NoneType' object has no attribute 'connect'
[ERROR IN PLAY SONG FUNCTION] -> 'NoneType' object has no attribute 'is_connected', <class 'AttributeError'>

As a result, the following error occurred.
I modified the int and tried many things, but it didn't work for me.
Thank you for trying!🥹

from vulkan.

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024

I think this error is related to the first error you reported.
The error happens because the Bot is still loading and I used a function that retrieves the voiceChannel and this function returned None, which was an unexpected behavior.
I tried to fix that in this comit 97996a1.
Please check if everything is alright.

from vulkan.

kimjunsung04 avatar kimjunsung04 commented on June 4, 2024

I tried again with the new code and the same error occurred.

[ERROR CONNECTING TO VC] -> 'NoneType' object has no attribute 'connect'
[ERROR IN PLAY SONG FUNCTION] -> 'NoneType' object has no attribute 'is_connected', <class 'AttributeError'>

I think it's harder to trace the cause than I thought...

from vulkan.

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024

Are you sure that you have the latest bot version? And if you set up the attribute SONG_PLAYBACK_IN_SEPARATE_PROCESS to False as was described in the Settings page?

Because the function that are throwing this error is that:
image

If you take a look in the line 338 the execution will not pass this part until the property self.__voiceChannel is different from None, and the error you are reporting right now tells that 'NoneType' object has no attribute 'connect', so, I think that you are not using the correct version.

from vulkan.

RafaelSolVargas avatar RafaelSolVargas commented on June 4, 2024

Thanks for your time and tries, @kimjunsung04.
I'm closing this issue for now, but you can come back and report any issue at any time!

from vulkan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.