Skip to content

After customizing colors of multiple themes, theme changes stop being synced between instances (+assert fail in debug) #24724

Closed

Description

@cbjeukendrup

Issue type

Choose option...

Description with steps to reproduce

For example:

  1. Open Preferences > Appearance
  2. Customise accent colour of the light theme
  3. Switch to dark theme
    -> other instances still follow along correctly
  4. Customise accent color of dark theme
  5. Enable high contrast
  6. Customise accent color of dark high contrast theme
    -> at this point, changes stop being synchronised between instances

Also, in debug builds, this assertion fails at that point:

IF_ASSERT_FAILED(remaining <= MAX_PACKAGE_SIZE) {

Supporting files, videos and screenshots

Schermopname.2024-09-14.om.20.17.22.mov

What is the latest version of MuseScore Studio where this issue is present?

4.4.1, master

Regression

No.

Operating system

*

Additional context

No response

Checklist

  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible

Activity

  1. moved this to First release after the upcoming one in MuseScore Studio Backlogon Sep 17, 2024
  2. added
    P3
    on Sep 17, 2024
  3. krasko78 commented on Jan 11, 2025

    @krasko78
    Contributor

    @cbjeukendrup @Eism @igorkorsukov I am not sure who to ask so tagging you all. The problem here is that the themes setting ui/application/themes is more than 2048 bytes long (on my machine it is 3531 bytes holding 4 themes) and the IPC communication cannot handle messages of more than 2048 bytes (MAX_PACKAGE_SIZE) for which there is an assert in ipc::readFromSocket in ipc.cpp (can be found in the description of this issue).

    My question is: how do we want to fix this:

    1. Do we want to send all messages in chunks of no more than MAX_PACKAGE_SIZE bytes?

    2. Do we simply want to increase the value of MAX_PACKAGE_SIZE for now? This would be a super simple fix but would make the problem return in case in the future a message ends up being longer. Also it is unknown whether it is safe to increase this value and how much - it must be there for a reason after all. I tried looking at the history and finding out what had necesitated limiting the incoming packages to 2048 bytes and all I was able to dig out was an "out-of-range error". I didn't find any issue associated with this change and the info was scarce. It is unlikely that @Eism or @DmitryArefiev will remember (it is not a recent change) but let's give it a try. Here is the commit with the change.

    3. Other ideas?

  4. igorkorsukov commented on Jan 13, 2025

    @igorkorsukov
    Member

    @krasko78

    I believe the best solution right now is to simply increase the maximum package size.
    And I think we should check the size of the data both when sending and when receiving.
    add check to bool muse::ipc::writeToSocket(QLocalSocket* socket, const QByteArray& data)

    I think at this stage this should be enough, because this system was not intended for transmitting large messages.
    Also, work is currently underway, based on the results of which we will probably abandon this system (there will be one process for all windows, and not many instances)

    If this system still remains and we need to send large messages, then we will have at least two options:

    1. Make the transfer at the infrastructure level, i.e. at the IPC channel level, break the message into parts, and then build it from the parts... Make some kind of protocol for this.

    2. At the client level, if the client knows that his special message may be too large, he can break it into parts and then build it (i.e. this will be an exceptional situation for special cases)

    But, as I wrote above, this is not needed at the moment and may not be needed at all.

  5. krasko78 commented on Jan 13, 2025

    @krasko78
    Contributor

    Thank you, @igorkorsukov.

    @Eism and @DmitryArefiev : do you guys remember what out-of-range error exactly was fixed with the above-mentioned commit where the max package size of 2048 bytes was introduced? How was the value 2048 chosen? I know it is been a while since that change was put in place. Anything you can remember will be appreciated.

  6. Eism commented on Jan 14, 2025

    @Eism
    Collaborator

    @krasko78
    This fix was made after receiving several crash reports from users. For example

    13  Qt5Core.dll                     0x7ff98d7f4eac      <unknown>
    14  MuseScore4.exe                  0x1419806b4         static bool <lambda_63f5d4781e420115234e3aad76d242c7>::operator()() (ipc.cpp:111)
    15  MuseScore4.exe                  0x14198f5eb         mu::ipc::readFromSocket(QLocalSocket *,std::function<void >) (ipc.cpp:134)
    16  MuseScore4.exe                  0x14198dae7         mu::ipc::IpcSocket::onReadyRead() (ipcsocket.cpp:110)
    

    The value was chosen experimentally: I logged the value, launched a couple of MuseScore instances, chose the maximum value (200), and multiplied it by 10. So perhaps the option of increasing the value is what we need.

  7. krasko78 commented on Jan 14, 2025

    @krasko78
    Contributor

    Thanks @Eism. I'll go ahead and bump the value up to 4096.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions