f2e-spec icon indicating copy to clipboard operation
f2e-spec copied to clipboard

Performous crashes with cannot create std::vector larger than max_size() when trying to play a song

Open soonick opened this issue 3 months ago • 8 comments

Performous & operating system versions

Performous: master branch (d5278e3) Operating system: Ubuntu 25.04

What is the problem?

Performous crashes after selecting to start playing a song with the following log:

[01:46:11]:::LOGGER / ERROR::: cannot create std::vector larger than max_size()

Steps to reproduce

  1. Select a song on the song list
  2. Select "play" on the next screen

Additional context

The issue seems to be triggered when we try to create a Player because the frames parameter is 9223372036854775808, and it tries to create a vector with that many elements, which is not possible.

The reason frames has that value is because endTime is never set for the song. The only place where I could find it being set is in SongParser::finalize, which is only called from SongParser::SongParser, but only if s.loadStatus == Song::LoadStatus::HEADER.

I'm not completely sure how s.loadStatus is supposed to work, but I found a way to fix the problem for me, so I'll create a pull request and wait for feedback.

Log(s) & preferences file(s)

[01:46:11]:::LOGGER / ERROR::: cannot create std::vector larger than max_size()

soonick avatar Sep 26 '25 17:09 soonick

Video showing the crash

https://github.com/user-attachments/assets/9df3895c-b24c-458d-873e-1f7202a74961

soonick avatar Sep 27 '25 00:09 soonick

I went all the way back to the current stable version (1.3.1) and I get the same error, so it might be something very particular about my setup

soonick avatar Sep 29 '25 05:09 soonick

Does this happen on a particular song? All songs? If it's just a single song, is it possible for you to direct us to it on USDB, or perhaps attach the .txt ?

kt-- avatar Oct 01 '25 02:10 kt--

It happens with all songs

soonick avatar Oct 01 '25 09:10 soonick

I noticed something interesting. After deleting my ~./config/performous folder, things started working.

The weird thing is that my configurations worked with the version of performous that comes from Ubuntu repositories, but not with the version I compiled myself . It makes me think that it might be some issue with forward compatibility of configuration.xml or database.xml.

Sadly, I don't have the versions of the configurations that trigger the problem anymore, so I'm unable to debug ☹️ .

I'll close the issue, as I'm unable to reproduce.

soonick avatar Oct 01 '25 15:10 soonick

I was able to reproduce the issue again and did a little more digging.

The issue seems to be caused by some incompatibility between the different versions of performous.

When I use the version of performous shipped with Ubuntu 25.10 (the latest one), the songs.json cache file doesn't have the loadStatus field.

The master branch seems to always set the value to 1.

In the master branch, things work well when the value is 1, but crashes when the value is 0.

You should be able to reproduce the issue by changing the value from 1 to 0 in your songs.json cache file.

I think a value of 0 might not make sense here, since the cache file actually has the header information already, and things don't seem to work when the value is 0.

I created a pull request.

soonick avatar Oct 11 '25 14:10 soonick

@soonick There were a few changes made to the cache file over the past year or so which could cause these issues. We don't have any control over what versions are used or how it's built in the Ubuntu repos. We don't even know who the package maintainer for the Ubuntu repos are, they do everything completely on their own. My guess is they are using the latest tag to build with, which is ~2 years old at this point. It would be interesting to see if you run into these issues with official packages. As far as I know, Performous should do the right thing and automatically upgrade the cache file to be compatible with the version you just installed, but there could definitely be bugs for sure :-)

ooshlablu avatar Oct 11 '25 15:10 ooshlablu

@ooshlablu , I understand that it's not possible to control the versions being used and that backwards compatibility might not always be possible, but it seems like the current way loadStatus is set when loading a song from cache is just unnecessarily fragile. Performous will crash when that value is NONE, so why do we even allow it to get into that state?

Try setting loadStatus to 0 in one of your songs in cache and then try playing that song. Does it crash? If so, there are two options:

  • loadStatus is never set to 0 in newer versions of performous, so that field is really not useful and loading songs with that field set to HEADER makes performous more backwards compatible
  • loadStatus is set to 0 in some obscure scenarios, and it causes performous to crash

In any of those cases, I believe #1090 makes performous better

soonick avatar Oct 12 '25 02:10 soonick