Barotrauma icon indicating copy to clipboard operation
Barotrauma copied to clipboard

Error while reading a message from server. {Input contains duplicate packages}

Open evilfactory opened this issue 2 years ago • 2 comments

Disclaimers

  • [X] I have searched the issue tracker to check if the issue has already been reported.
  • [X] My issue happened while using mods.

What happened?

While trying to join a server with two mods without any content defined, i seem to get the Input contains duplicate packages error.

Reproduction steps

these are the two mods, simply place the xml content inside LocalMods/Test1/filelist.xml and LocalMods/Test2/filelist.xml to test.

<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="Test1" corepackage="false" modversion="1.0">

</contentpackage>
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="Test2" corepackage="false" modversion="1.0">

</contentpackage>
  1. Enable the Test1 and Test2 mods described above
  2. Start a dedicated server (note: this still happen with player-hosted, it just doesn't happen with the person hosting the server)
  3. Join the dedicated server

Bug prevalence

Happens every time I play

Version

0.19.10.0

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

Error while reading a message from server. {Input contains duplicate packages}
   at Barotrauma.ContentPackageManager.EnabledPackages.ThrowIfDuplicates(IEnumerable`1 pkgs)
   at Barotrauma.ContentPackageManager.EnabledPackages.SetRegularEnumerable(IReadOnlyList`1 inNewRegular)+MoveNext()
   at Barotrauma.Extensions.IEnumerableExtensions.Consume[T](IEnumerable`1 enumerable)
   at Barotrauma.ModDownloadScreen.Select()
   at Barotrauma.Networking.GameClient.OnConnectionInitializationComplete()
   at Barotrauma.Networking.LidgrenClientPeer.HandleDataMessage(NetIncomingMessage lidgrenMsg)
   at Barotrauma.Networking.LidgrenClientPeer.Update(Single deltaTime)
   at Barotrauma.Networking.GameClient.Update(Single deltaTime)

evilfactory avatar Oct 05 '22 18:10 evilfactory

Thank you for the report! This seemed to happen if the server was using multiple content packages with the same MD5 hash (i.e. identical content files - or in this case, no content files at all). Fixed in https://github.com/Regalis11/Barotrauma-development/commit/42fb6b9a66aeeb072022d21dc0c0521048917234

Regalis11 avatar Oct 05 '22 19:10 Regalis11

Nice job on the fast fix - it's just too bad it didn't make it into today's patch so people are going to have to wait for the next followup fix.

Ek-Videogames avatar Oct 06 '22 17:10 Ek-Videogames

Tested against dev commit https://github.com/Regalis11/Barotrauma-development/commit/3f874d71a8cdc82d1d16314abdd6ae91f7e42098, no issues found, closing.

Notes: If the enabled packages have the same MD5 but a different name in the filelist, no errors are thrown. If you have the same MD5 and name in the filelist (but a different path) then it will throw an error as it should do. so long as content without XML/MD5 content (IE. lua mods) have different names in filelist the fix works as expected.

NilanthAnimosus avatar Oct 10 '22 16:10 NilanthAnimosus

@Regalis11, sorry to ping about a specific issue, but is there an ETA for this hotfix to go live? It's impacting CsForBarotrauma which is used quite a bit around the modding scene https://steamcommunity.com/sharedfiles/filedetails/?id=2795927223

theCrius avatar Oct 18 '22 11:10 theCrius

This should be present in 0.19.11.0 onwards (Which I believe is the current stable version). If its not working (and csforbarotrauma is updated properly so its own code matches barotrauma in that area) it could be there are other issues present here, but I don't think its listed in the changelogs either despite its included in that version.

As a note, if there is no XML content for an MD5 hash, it will work fine as long as the name also is not identical (even if a different path). If the names match alongside the Md5 (IE. only c# or lua content) it will act as before.

NilanthAnimosus avatar Oct 19 '22 12:10 NilanthAnimosus

I definitely got this error on the current stable version and latest version of CsForBarotrauma.

Paging @evilfactory for confirmation. Maybe I didn't get the latest-est version.

I'll try again but I finished messing with it literally a couple days ago.

theCrius avatar Oct 19 '22 15:10 theCrius

After testing on v0.19.14.0 the original test case doesn't cause the error anymore, but i found out that it still happens with these specific filelists and in a separate dedicated server.

<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="EndRoundCondition" corepackage="false" modversion="1.0">

</contentpackage>
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="BaroStats" corepackage="false" modversion="1.0">

</contentpackage>

Reproduction steps:

  • Install a separate dedicated server, you can't use the existing dedicated server found in your game files, because the issue doesn't seem happen if the mod is in your disabled list of mods
  • Place the two filelists inside your separate dedicated server, LocalMods/BaroStats/filelist.xml LocalMods/EndRoundCondition/filelist.xml
  • Start the server and try joining it
Error while reading a message from server. {Input contains duplicate packages}
   at Barotrauma.ContentPackageManager.EnabledPackages.ThrowIfDuplicates(IEnumerable`1 pkgs) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\ContentManagement\ContentPackageManager.cs:line 114
   at Barotrauma.ContentPackageManager.EnabledPackages.SetRegularEnumerable(IReadOnlyList`1 inNewRegular)+MoveNext() in <DEV>\Barotrauma\BarotraumaShared\SharedSource\ContentManagement\ContentPackageManager.cs:line 81
   at Barotrauma.Extensions.IEnumerableExtensions.Consume[T](IEnumerable`1 enumerable) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Extensions\IEnumerableExtensions.cs:line 149
   at Barotrauma.ModDownloadScreen.Select() in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Screens\ModDownloadScreen.cs:line 110
   at Barotrauma.Networking.GameClient.OnConnectionInitializationComplete() in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Networking\GameClient.cs:line 1064
   at Barotrauma.Networking.LidgrenClientPeer.HandleDataMessage(NetIncomingMessage lidgrenMsg) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Networking\Primitives\Peers\LidgrenClientPeer.cs:line 156
   at Barotrauma.Networking.LidgrenClientPeer.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Networking\Primitives\Peers\LidgrenClientPeer.cs:line 123
   at Barotrauma.Networking.GameClient.Update(Single deltaTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\Networking\GameClient.cs:line 477

DedicatedServer_NaapQssb1M

evilfactory avatar Oct 20 '22 20:10 evilfactory

Issue is still occurring when friends try to join my modded server, even after updating Lua and Cs

Error while reading a message from server. {Input contains duplicate packages} at Barotrauma.ContentPackageManager.EnabledPackages.ThrowIfDuplicates(IEnumerable1 pkgs) at Barotrauma.ContentPackageManager.EnabledPackages.SetRegularEnumerable(IReadOnlyList1 inNewRegular)+MoveNext() at Barotrauma.Extensions.IEnumerableExtensions.Consume[T](IEnumerable`1 enumerable) at Barotrauma.ModDownloadScreen.Select() at Barotrauma.Networking.GameClient.OnConnectionInitializationComplete() at Barotrauma.Networking.SteamP2PClientPeer.Update(Single deltaTime) at Barotrauma.Networking.GameClient.Update(Single deltaTime)

daaurpoj avatar Oct 21 '22 00:10 daaurpoj

Addressed in https://github.com/Regalis11/Barotrauma-development/commit/1fe17cd7d8d1f67f80ffb6f6ef33977517f4a4d3.

In @evilfactory's test case the issue was still the identical MD5 hashes. The fix I implemented before made the client try to find the correct package based on the name, but that obviously won't work if the client doesn't have that mod. Fixed by making the server not report empty packages to the clients at all, nor require the client to have them.

Regalis11 avatar Oct 21 '22 12:10 Regalis11

Addressed in Regalis11/Barotrauma-development@1fe17cd.

In @evilfactory's test case the issue was still the identical MD5 hashes. The fix I implemented before made the client try to find the correct package based on the name, but that obviously won't work if the client doesn't have that mod. Fixed by making the server not report empty packages to the clients at all, nor require the client to have them.

Not sure if this is the right place to ask...

For the uninitiated, these fixes will take some amount of days or weeks before being applied in a patch, correct?

Is there any way to play a version of Barotrauma with this fix already applied?

daaurpoj avatar Oct 22 '22 18:10 daaurpoj

After testing on v0.20.0.0 the error doesn't happen anymore, seems to be working as intended now.

evilfactory avatar Oct 27 '22 22:10 evilfactory