Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: bytearray index out of range #511

Closed
DAMcraft opened this issue Apr 13, 2023 · 28 comments · Fixed by #512 or #515
Closed

IndexError: bytearray index out of range #511

DAMcraft opened this issue Apr 13, 2023 · 28 comments · Fixed by #512 or #515
Assignees
Labels
type: bug Something isn't working

Comments

@DAMcraft
Copy link
Contributor

This happens for example using JavaServer.lookup() with the following ip: 135.148.100.83:25572

Traceback:

Traceback (most recent call last):
  File "/root/ServerSeeker/scan.py", line 42, in scan_chunk
    status = JavaServer.lookup(f"{ip}:{port}").status()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 128, in status
    return self._retry_status(connection, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 66, in sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
    ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 62, in sync_wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 134, in _retry_status
    result = pinger.read_status()
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/pinger.py", line 116, in read_status
    if response.read_varint() != 0:
       ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py", line 254, in read_varint
    part = self.read(1)[0]
           ~~~~~~~~~~~~^^^
IndexError: bytearray index out of range
@PerchunPak
Copy link
Member

PerchunPak commented Apr 13, 2023

Interesting... Do you know the server owner? If so, what is server's software and version?

Also, https://mcstatus.io and https://mcsrvstat.us can't get the status too

@DAMcraft
Copy link
Contributor Author

Nope, my minecraft server scanner just throws an error each time it pings it

@PerchunPak
Copy link
Member

I got Timed Out with this IP, possibly the owner stopped it. Is it possible that on this port is hosted not a Minecraft server?

@DAMcraft
Copy link
Contributor Author

Seems to be offline right now. I get those errors occasionly when scanning the internet

I will update you if I find another server that is currently online

@DAMcraft
Copy link
Contributor Author

Alright it just happened with 45.159.6.50:26062
Again, it is now offline. Maybe this happens when the server shuts down / socket stops during the ping? After all I ping ~320.000 servers in 5 minutes, it‘d totally be possible one shuts down during the ping

@ItsDrike ItsDrike added the type: bug Something isn't working label Apr 13, 2023
@PerchunPak
Copy link
Member

Whatever it is, I'm sure that we should look at what server answers (it's an error in low-level server answer parsing system). Try to get this error with traceback-with-variables installed. If it will not display any useful info, I will try to build special debug version.

@DAMcraft
Copy link
Contributor Author

Running it now. After my last reply it happened two more times, again, the server seems to be offline.

@kevinkjt2000 kevinkjt2000 added the meta: Not Enough Information Further clarification is needed label Apr 13, 2023
@PerchunPak
Copy link
Member

Running it now. After my last reply it happened two more times, again, the server seems to be offline.

Have you catched it with traceback-with-variables installed? If so, can you provide the traceback please?

@DAMcraft
Copy link
Contributor Author

Sadly I am running it on screen, and for some reason it doesn‘t allow me to scroll up (even though I have it enabled on screen). I only get partial variables because of this. I am currently trying to log it into a file.

@DAMcraft
Copy link
Contributor Author

Got it!

Traceback with variables (most recent call last):
  File "/root/ServerSeeker/scan.py", line 43, in scan_chunk
    status = JavaServer.lookup(f"{ip}:{port}").status()
      chunked_servers = [('107.211.13.183', 25565), ('176.57.160.26', 28565), ('134.255.225.37', 25565), ('104.223.101.
159', 25565), ('34.84.62.58', 25565), ('134.255.208.71', 10070), ('172.104.142.38', 25565), ('174.138.44.86', 25567), (
'37.187.146.107', 25576), ('72.241.47.98', 25565), ('43.142.155.222', 25565), ('158.62.203.78', 25565), ('82.135.8.58',
 25565), ('160.251.47.201', 25565), ('134.255.208.174', 15800), ('143.47.229.229', 25568), ('185.100.87.141', 25567), (
'5.83.172.139', 26800), ('84.168.10.113', 25565), ('119.252.189.42', 27149), ('51.81.28.96', 25603), ('74.133.75.53', 2
5565), ('138.3.216.148', 25565), ('149.56.249.114', 10735), ('78.129.254.40', 25590), ('146.59.0.142', 25621), ('118.27
.17.66', 25565), ('83.29.5.91', 25565), ('104.168.51.229', 25565), ('45.139.112.125', 25565), ('141.94.16.144', 25565),
 ('75.186.3.216', 25565), ('142.132.210.233', 25565), ('75.119.140.238', 25565), ('162.33.30.236', 25574), ('34.64.174.
255', 25565), ('195.82.159.241', 30800), ('144.76.38.79', 25570), ('46.1...
      res = [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, Non
e, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, No
ne, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, N
one, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
 None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, Non
e, None, None, None, None, None, None, None, None, None, Non...
      index = 311
      statuses = [{'ip': '107.211.13.183', 'port': 25565, 'last_seen': 1681458470, 'version': 'Spigot 1.19.4', 'protoco
l': 762, 'online_count': 0, 'max_count': 20, 'description': 'A Spigot Minecraft Server powered by Docker', 'favicon': N
one, 'online_players': {}}, {'ip': '176.57.160.26', 'port': 28565, 'last_seen': 1681458470, 'version': '1.16.5', 'proto
col': 754, 'online_count': 0, 'max_count': 4, 'description': 'Modded SpaÃ\x9f', 'favicon': None, 'online_players': {}},
 {'ip': '104.223.101.159', 'port': 25565, 'last_seen': 1681458470, 'version': '1.12.2', 'protocol': 340, 'online_count'
: 0, 'max_count': 7, 'description': 'A Minecraft Server', 'favicon': None, 'online_players': {}}]
      current_server_index = 4
      server = ('34.84.62.58', 25565)
      ip = '34.84.62.58'
      port = 25565
      status = None

     clean_status = {'ip': '104.223.101.159', 'port': 25565, 'last_seen': 1681458470, 'version': '1.12.2', 'protocol': 340, 'online_count': 0, 'max_count': 7, 'description': 'A Minecraft Server', 'favicon': None, 'online_players': {}}
      e = IndexError('bytearray index out of range')
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 128, in status
    return self._retry_status(connection, **kwargs)
      self = <mcstatus.server.JavaServer object at 0x7feaf449bbd0>
      kwargs = {}
      connection = <TCPSocketConnection Object>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 66, in sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
      tries = 3 
      args = (<mcstatus.server.JavaServer object at 0x7feaf449bbd0>, <TCPSocketConnection Object>)
      kwargs = {}
      _ = 2
      last_exc = IndexError('bytearray index out of range')
      exceptions = (<class 'Exception'>,)
      func = <function JavaServer._retry_status at 0x7feafce97f60>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 62, in sync_wrapper
    return func(*args, **kwargs)
      tries = 3 
      args = (<mcstatus.server.JavaServer object at 0x7feaf449bbd0>, <TCPSocketConnection Object>)
      kwargs = {}
      _ = 2
      last_exc = IndexError('bytearray index out of range')
      exceptions = (<class 'Exception'>,)
      func = <function JavaServer._retry_status at 0x7feafce97f60>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 134, in _retry_status
    result = pinger.read_status()
      self = <mcstatus.server.JavaServer object at 0x7feaf449bbd0>
      connection = <TCPSocketConnection Object>
      kwargs = {}
      pinger = <mcstatus.pinger.ServerPinger object at 0x7feaf41e7fd0>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/pinger.py", line 116, in read_status
    if response.read_varint() != 0:
      self = <mcstatus.pinger.ServerPinger object at 0x7feaf41e7fd0>
      request = <Connection Object>
      start = 1780212.655210154

      response = <Connection Object>
      received = 1780212.889161273
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py", line 254, in read_varint
    part = self.read(1)[0]
      self = <Connection Object>
      result = 0
      i = 0
builtins.IndexError: bytearray index out of range

@PerchunPak
Copy link
Member

Okay, we need to do more for debugging this. Currently it doesn't show anything important, because of hiding object attributes while printing it. I will try to find a way to save some dump for later debug (so you can transfer it to us). I guess it's named memory dumps.

PerchunPak added a commit to PerchunPak/mcstatus that referenced this issue Apr 14, 2023
@PerchunPak
Copy link
Member

PerchunPak commented Apr 14, 2023

So, it's ready. I added some more information to the class instance, so we will see what a server answered. It might be quite slower, but it should be negligible.

Just do

pip install git+https://github.com/PerchunPak/mcstatus.git@debug

(keep your traceback-with-variables on)

@DAMcraft
Copy link
Contributor Author

Throws an error about every second ping :/

Traceback with variables (most recent call last):
  File "/root/ServerSeeker/scan.py", line 57, in scan_chunk
    "favicon": status.favicon,
      chunked_servers = [('5.83.172.202', 16400), ('142.44.191.203', 25575), ('31.17.241.248', 25565), ('147.135.122.214', 25565), ('185.231.154.15', 25565), ('69.165.217.100', 25565), ('82.65.102.235', 25565), ('65.108.24.133', 25675), ('71.223.50.172', 25565), ('120.75.104.64', 25565), ('149.56.155.218', 25566), ('71.30.243.78', 25565), ('35.131.184.45', 25567), ('191.101.233.246', 25565), ('38.105.9.118', 25565), ('176.57.174.213', 27165), ('210.9.144.122', 25565), ('69.125.7.167', 25565), ('51.81.53.220', 25669), ('87.61.90.11', 25565), ('89.12.55.120', 25565), ('84.179.220.109', 25565), ('161.97.167.8', 33465), ('160.86.15.192', 25565), ('176.57.149.88', 25565), ('24.117.113.48', 25565), ('135.148.30.77', 25570), ('104.157.10.10', 25567), ('119.252.191.15', 25580), ('135.125.65.202', 25621), ('31.214.204.26', 59000), ('143.47.180.174', 25565), ('135.148.140.32', 25574), ('98.23.32.180', 25565), ('31.214.162.18', 15553), ('192.99.150.181', 25565), ('54.201.75.79', 25565), ('23.109.64.124', 25565), ('5.83....
      res = [[], [], None, [], [], None, [], None, None, [], [], [], None, [], [], [], [], [], [], [], [], None, None, [], [], None, None, None, None, [], None, None, [], [], [], [], None, [], [], [], [], [], [], [], [], None, [], [], None, [], [], [], [], [], [], None, [], [], [], [], None, None, [], [], None, [], None, [], [], None, None, [], [], [], [], [], [], None, [], [], [], [], [], [], [], [], [], [], [], None, None, None, [], None, None, [], [], [], None, [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], None, None, [], [], [], None, [], [], [], [], [], [], None, None, None, [], [], [], None, [], [], [], [], None, None, None, None, [], None, [], None, [], None, [], [], [], [], [], None, None, [], [], [], [], [], [], [], [], [], None, None, [], [], None, [], None, [], None, [], None, [], [], [], [], [], [], None, None, [], [], [], [], [], [], [], [], None, [], [], [], [], None, [], [], [], [], [], None, [], [], [], [], None, [], None, None, [], None, [], [], [...
      index = 120
      statuses = []
      current_server_index = 768
      server = ('66.248.194.169', 25602)
      ip = '66.248.194.169'
      port = 25602
      status = JavaStatusResponse(players=JavaStatusPlayers(online=0, max=5, sample=None), version=JavaStatusVersion(name='1.7.10', protocol=5), motd='GT New Horizons 2.3.0-RC1', latency=46.38640000484884, raw={'description': 'GT New Horizons 2.3.0-RC1', 'players': {'max': 5, 'online': 0}, 'version': {'name': '1.7.10', 'protocol': 5}, 'favicon': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAeIklEQVR42u1bd1RU17c+gDHRmKiJ\nGnuKphkTE1PNL80kLzGJBdHEji0axQIoiIICUhRpSu+9DL23AYY2Q5sZeu+9KQg2bDDf2zOMBmLy\nfkl0vb+8rr2YNblz797f2fvb5Zww9vh6fD2+Hl+Pr8fX370U5PKPL40UsN2+YOtTobCBB4Wf+RLF\nn5Kh+CMXiuuyJIqb0qGgnASFrV5g7gD9AP+v+v2dB48nmSSXJ0kU/+pmvAf2XiKYmhmYciwU1iRi\n3NoUTFDhYbIKb3iGCvfm/LXxVxaujet/XSbxAwvXJg2+qMIbekElDVNUUjBROQFPkCjs8gdbVgIm\n/fcP9VN4lMZPIJm7ZQVTPfAzO0ifF8pfpCQHQvE++vTpG6s8hZVxt8appEueXpeOWRsysXhzFpZv\n5Ut+2ZpxW21jQt9J5eDmc6t8qy6s8qm8oMxpstgQ36u/Nf3mIbpnE937Lf1mybo0zFnLwzOrE+88\nsSKgSuHZ2U+OXmXFUTKRZP6OlWzXXhW2nz6/QvL0/7VI/8T4p0heVvmKaZYGsI6WaHbl8EZmRt+9\nTTKDZBrJdLr1eaY0Zcpz...
      e = AttributeError("'JavaStatusResponse' object has no attribute 'favicon'")
builtins.AttributeError: 'JavaStatusResponse' object has no attribute 'favicon'
[Scanner]     19:46:06: An unknown Error occurred: 'JavaStatusResponse' object has no attribute 'favicon'
[Scanner]     19:46:06: Thread: 372
[Scanner]     19:46:06: IP: 45.146.252.144:25565
[Scanner]     19:46:06: Status: JavaStatusResponse(players=JavaStatusPlayers(online=0, max=4, sample=None), version=JavaStatusVersion(name='1.7.10', protocol=5), motd='Hosted by ZAP-Hosting.com', latency=23.03494093939662, raw={'description': 'Hosted by ZAP-Hosting.com', 'players': {'max': 4, 'online': 0}, 'version': {'name': '1.7.10', 'protocol': 5}, 'modinfo': {'type': 'FML', 'modList': [{'modid': 'mcp', 'version': '9.05'}, {'modid': 'FML', 'version': '7.10.99.99'}, {'modid': 'Forge', 'version': '10.13.4.1614'}, {'modid': 'appliedenergistics2-core', 'version': 'rv3-beta-6'}, {'modid': 'Aroma1997Core', 'version': '1.0.2.16'}, {'modid': 'CodeChickenCore', 'version': '1.0.7.47'}, {'modid': 'NotEnoughItems', 'version': '1.0.5.120'}, {'modid': 'ThE-core', 'version': '1.0.0.1'}, {'modid': 'ThaumicTinkerer-preloader', 'version': '0.1'}, {'modid': 'ChocoPatcher', 'version': '1.1'}, {'modid': 'OpenModsCore', 'version': '0.10'}, {'modid': '<CoFH ASM>', 'version': '000'}, {'modid': 'BinniePatcher', 'version': '1.8.2'}, {'modid': 'FastCraft', 'version': '1.25'}, {'modid': 'debug', 'version': '1.0'}, {'modid': 'IC2', 'version': '2.2.827-experimental'}, {'modid': 'AdvancedSolarPanel', 'version': '1.7.10-3.5.1'}, {'modid': 'AgriCraft', 'version': '1.7.10-1.5.0'}, {'modid': 'appliedenergistics2', 'version': 'rv3-beta-6'}, {'modid': 'Aroma1997CoreHelper', 'version': '1.0.2.16'}, {'modid': 'Aroma1997sDimension', 'version': '1.0'}, {'modid': 'AWWayofTime', 'version': 'v1.3.3'}, {'modid': 'Baubles', 'version': '1.0.1.10'}, {'modid': 'Thaumcraft', 'version': '4.2.3.5'}, {'modid': 'Botania', 'version': 'r1.8-249'}, {'modid': 'Avaritia', 'version': '1.13'}, {'modid': 'bdlib', 'version': '1.9.4.109'}, {'modid': 'BiblioCraft', 'version': '1.11.7'}, {'modid': 'Mantle', 'version': '1.7.10-0.3.2.jenkins191'}, {'modid': 'Natura', 'version': '2.2.0'}, {'modid': 'BiomesOPlenty', 'version': '2.1.0'}, {'modid': 'BiblioWoodsBoP', 'version': '1.9'}, {'modid': 'CoFHCore', 'version': '1.7.10R3.1.4'}, {'modid': 'Forestry', 'version': '4.2.16.64'}, {'modid': 'BiblioWoodsForestry', 'version': '1.7'}, {'modid': 'BiblioWoodsNatura', 'version': '1.5'}, {'modid': 'ThermalFoundation', 'version': '1.7.10R1.2.6'}, {'modid': 'ThermalExpansion', 'version': '1.7.10R4.1.5'}, {'modid': 'BigReactors', 'version': '0.4.3A'}, {'modid': 'BinnieCore', 'version': '2.0-pre14'}, {'modid': 'Botany', 'version': '2.0-pre14'}, {'modid': 'ExtraBees', 'version': '2.0-pre14'}, {'modid': 'ExtraTrees', 'version': '2.0-pre14'}, {'modid': 'Genetics', 'version': '2.0-pre14'}, {'modid': 'BrandonsCore', 'version': '1.0.0.12'}, {'modid': 'BuildCraft|Core', 'version': '7.1.23'}, {'modid': 'BuildCraft|Transport', 'version': '7.1.23'}, {'modid': 'BuildCraft|Factory', 'version': '7.1.23'}, {'modid': 'BuildCraft|Silicon', 'version': '7.1.23'}, {'modid': 'BuildCraft|Robotics', 'version': '7.1.23'}, {'modid': 'BuildCraft|Energy', 'version': '7.1.23'}, {'modid': 'BuildCraft|Builders', 'version': '7.1.23'}, {'modid': 'BuildCraft|Compat', 'version': '7.1.7'}, {'modid': 'Railcraft', 'version': '9.12.2.0'}, {'modid': 'TwilightForest', 'version': '2.3.7'}, {'modid': 'ForgeMultipart', 'version': '1.2.0.345'}, {'modid': 'chisel', 'version': '2.9.5.11'}, {'modid': 'CarpentersBlocks', 'version': '3.3.8.1'}, {'modid': 'ComputerCraft', 'version': '1.75'}, {'modid': 'MineTweaker3', 'version': '3.0.13'}, {'modid': 'PTRModelLib', 'version': '1.0.0'}, {'modid': 'props', 'version': '2.4.2'}, {'modid': 'DraconicEvolution', 'version': '1.0.2h'}, {'modid': 'endercore', 'version': '1.7.10-0.2.0.39_beta'}, {'modid': 'MineFactoryReloaded', 'version': '1.7.10R2.8.1'}, {'modid': 'Waila', 'version': '1.5.10'}, {'modid': 'EnderIO', 'version': '1.7.10-2.3.0.429_beta'}, {'modid': 'EnderStorage', 'version': '1.4.7.37'}, {'modid': 'EnderTech', 'version': '1.7.10-0.3.2.405'}, {'modid': 'EnderZoo', 'version': '1.7.10-1.0.15.32'}, {'modid': 'extracells', 'version': '2.3.14'}, {'modid': 'ExtraUtilities', 'version': '1.2.12'}, {'modid': 'harvestcraft', 'version': '1.7.10j'}, {'modid': 'ImmersiveEngineering', 'version': '0.7.7'}, {'modid': 'TConstruct', 'version': '1.7.10-1.8.8.build988'}, {'modid': 'ExtraTiC', 'version': '1.4.6'}, {'modid': 'fastleafdecay', 'version': '1.4'}, {'modid': 'ThaumicTinkerer', 'version': 'unspecified'}, {'modid': 'ForbiddenMagic', 'version': '1.7.10-0.575'}, {'modid': 'FTBL', 'version': '1.0.18.2'}, {'modid': 'FTBT', 'version': '1.0.2'}, {'modid': 'FTBU', 'version': '1.0.18.2'}, {'modid': 'funkylocomotion', 'version': '1.0'}, {'modid': 'RedstoneArsenal', 'version': '1.7.10R1.1.2'}, {'modid': 'MagicBees', 'version': '2.4.4'}, {'modid': 'gendustry', 'version': '1.6.3.132'}, {'modid': 'GraviSuite', 'version': '1.7.10-2.0.3'}, {'modid': 'guideapi', 'version': '1.7.10-1.0.1-20'}, {'modid': 'iChunUtil', 'version': '4.2.3'}, {'modid': 'Hats', 'version': '4.0.1'}, {'modid': 'HatStand', 'version': '4.0.0'}, {'modid': 'headcrumbs', 'version': '1.7.4'}, {'modid': 'HardcoreQuesting', 'version': '4.4.4'}, {'modid': 'IC2NuclearControl', 'version': '2.4.3a'}, {'modid': 'immersiveintegration', 'version': '0.6.8'}, {'modid': 'inpure|core', 'version': '1.7.10R1.0.0B9'}, {'modid': 'inventorytweaks', 'version': '1.59-dev-152-cf6e263'}, {'modid': 'IronChest', 'version': '6.0.62.742'}, {'modid': 'JABBA', 'version': '1.2.2'}, {'modid': 'journeymap', 'version': '5.1.4p2'}, {'modid': 'letsencryptcraft', 'version': '@VERSION@'}, {'modid': 'LogisticsPipes', 'version': '0.9.3.132'}, {'modid': 'MineFactoryReloaded|CompatAppliedEnergistics', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatBuildCraft', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatForestry', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatForgeMicroblock', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatIC2', 'version': '1.7.10R2.8.1'}, {'modid': 'MrTJPCoreMod', 'version': '1.1.0.33'}, {'modid': 'ProjRed|Core', 'version': '4.7.0pre12.95'}, {'modid': 'ProjRed|Exploration', 'version': '4.7.0pre12.95'}, {'modid': 'MineFactoryReloaded|CompatProjRed', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatRailcraft', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatThaumcraft', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatThermalExpansion', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatTConstruct', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatTwilightForest', 'version': '1.7.10R2.8.1'}, {'modid': 'MineFactoryReloaded|CompatVanilla', 'version': '1.7.10R2.8.1'}, {'modid': 'modtweaker2', 'version': '0.9.6'}, {'modid': 'Morpheus', 'version': '1.7.10-1.6.21'}, {'modid': 'Mystcraft', 'version': '0.12.3.04'}, {'modid': 'NEIAddons', 'version': '1.12.14.40'}, {'modid': 'NEIAddons|Developer', 'version': '1.12.14.40'}, {'modid': 'NEIAddons|AppEng', 'version': '1.12.14.40'}, {'modid': 'NEIAddons|Botany', 'version': '1.12.14.40'}, {'modid': 'NEIAddons|Forestry', 'version': '1.12.14.40'}, {'modid': 'NEIAddons|CraftingTables', 'version': '1.12.14.40'}, {'modid': 'NEIAddons|ExNihilo', 'version': '1.12.14.40'}, {'modid': 'neiintegration', 'version': '1.1.2'}, {'modid': 'NetherOres', 'version': '1.7.10R2.3.1'}, {'modid': 'neresources', 'version': '0.1.0.ManuallyBuilt'}, {'modid': 'OpenMods', 'version': '0.10'}, {'modid': 'OpenBlocks', 'version': '1.6'}, {'modid': 'OpenPeripheralCore', 'version': '1.4'}, {'modid': 'OpenPeripheral', 'version': '0.6'}, {'modid': 'OpenPeripheralIntegration', 'version': '0.6'}, {'modid': 'PortalGun', 'version': '4.0.0-beta-6'}, {'modid': 'ProjRed|Transmission', 'version': '4.7.0pre12.95'}, {'modid': 'ProjRed|Transportation', 'version': '4.7.0pre12.95'}, {'modid': 'ProjRed|Compatibility', 'version': '4.7.0pre12.95'}, {'modid': 'ProjRed|Integration', 'version': '4.7.0pre12.95'}, {'modid': 'ProjRed|Illumination', 'version': '4.7.0pre12.95'}, {'modid': 'ProjRed|Expansion', 'version': '4.7.0pre12.95'}, {'modid': 'rftools', 'version': '4.23'}, {'modid': 'runicdungeons', 'version': '1.1.7b'}, {'modid': 'simplyjetpacks', 'version': '1.5.3'}, {'modid': 'SolarExpansion', 'version': '1.6a'}, {'modid': 'springboards', 'version': '0.1'}, {'modid': 'StevesFactoryManager', 'version': 'A93'}, {'modid': 'StevesAddons', 'version': '0.10.16'}, {'modid': 'StevesCarts', 'version': '2.0.0.b18'}, {'modid': 'StevesWorkshop', 'version': '0.5.1'}, {'modid': 'StorageDrawers', 'version': '1.7.10-1.10.9'}, {'modid': 'StorageDrawersBop', 'version': '1.7.10-1.1.1'}, {'modid': 'StorageDrawersForestry', 'version': '1.7.10-1.1.2'}, {'modid': 'StorageDrawersMisc', 'version': '1.7.10-1.1.2'}, {'modid': 'StorageDrawersNatura', 'version': '1.7.10-1.1.1'}, {'modid': 'tcinventoryscan', 'version': '1.0.11'}, {'modid': 'thaumcraftneiplugin', 'version': '@VERSION@'}, {'modid': 'thaumicenergistics', 'version': '1.1.3.0'}, {'modid': 'ThaumicExploration', 'version': '0.6.0'}, {'modid': 'ThermalDynamics', 'version': '1.7.10R1.2.1'}, {'modid': 'TiCTooltips', 'version': '1.2.5'}, {'modid': 'TMechworks', 'version': '0.2.15.106'}, {'modid': 'Translocator', 'version': '1.1.2.16'}, {'modid': 'WailaHarvestability', 'version': '1.1.6'}, {'modid': 'wawla', 'version': '1.3.1'}, {'modid': 'witchery', 'version': '0.24.1'}, {'modid': 'WR-CBE|Core', 'version': '1.4.1.9'}, {'modid': 'WR-CBE|Addons', 'version': '1.4.1.9'}, {'modid': 'WR-CBE|Logic', 'version': '1.4.1.9'}, {'modid': 'McMultipart', 'version': '1.2.0.345'}, {'modid': 'ForgeRelocation', 'version': '0.0.1.4'}, {'modid': 'MCFrames', 'version': '1.0'}, {'modid': 'RelocationFMP', 'version': '0.0.1.2'}, {'modid': 'aobd', 'version': '2.9.2'}, {'modid': 'denseores', 'version': '1.0'}, {'modid': 'ForgeMicroblock', 'version': '1.2.0.345'}]}}, icon=None)
[Scanner]     19:46:06: Cause: None
[Scanner]     19:46:06: Traceback:
Traceback (most recent call last):
  File "/root/ServerSeeker/scan.py", line 57, in scan_chunk
    "favicon": status.favicon,
               ^^^^^^^^^^^^^^
AttributeError: 'JavaStatusResponse' object has no attribute 'favicon'

@DAMcraft
Copy link
Contributor Author

Welp seems like debug doesn't have a favicon anymore

@DAMcraft
Copy link
Contributor Author

Oh nvm that's a new version thing

@DAMcraft
Copy link
Contributor Author

Running debug now, wondering why JSR.favicon got removed in the new version though

@ItsDrike
Copy link
Member

ItsDrike commented Apr 14, 2023

Running debug now, wondering why JSR.favicon got removed in the new version though

That was done as a part of #306, this rename along with a lot of other changes are not yet released, but that's what the next version of mcstatus will use (there's a pre-release already though)
image

However there probably should've been a deprecated fallback, you shouldn't be seeing a hard exception there, just a warning; CC @PerchunPak

@DAMcraft
Copy link
Contributor Author

Got the error!


Traceback with variables (most recent call last):
  File "/root/ServerSeeker/scan.py", line 43, in scan_chunk
    status = JavaServer.lookup(f"{ip}:{port}").status()
      chunked_servers = [('135.148.39.146', 25577), ('98.117.90.222', 25565), ('                                                                                                                              150.116.232.85', 25565), ('149.56.12.167', 25565), ('51.81.174.202', 25571), ('1                                                                                                                              56.57.25.56', 25565), ('51.81.61.203', 25565), ('162.33.24.21', 25565), ('45.159                                                                                                                              .6.54', 25984), ('51.81.171.174', 25592), ('173.208.97.242', 27251), ('192.3.152                                                                                                                              .126', 25565), ('5.83.173.155', 43200), ('72.131.84.164', 25565), ('31.214.161.1                                                                                                                              0', 25606), ('185.232.71.95', 25561), ('51.81.166.33', 25573), ('134.255.208.149                                                                                                                              ', 10010), ('23.88.33.145', 25570), ('198.24.177.77', 25565), ('167.114.210.42',                                                                                                                               25587), ('176.57.143.65', 26905), ('79.210.228.208', 25565), ('5.101.165.148',                                                                                                                               63400), ('95.216.19.106', 25577), ('157.7.194.142', 25565), ('93.186.201.76', 25                                                                                                                              565), ('140.141.197.44', 25565), ('5.83.168.42', 50200), ('172.104.96.223', 2556                                                                                                                              5), ('142.4.223.231', 25580), ('194.182.23.35', 25683), ('5.83.168.155', 10670),                                                                                                                               ('44.210.113.85', 25565), ('129.153.191.103', 25565), ('51.178.89.144', 25580),                                                                                                                               ('135.148.49.222', 25588), ('185.77.196.23', 25569), ('45.159.6...
      res = [[], [], [{'ip': '155.94.175.75', 'port': 25584, 'last_seen': 168150                                                                                                                              4053, 'version': '1.7.10', 'protocol': 5, 'online_count': 0, 'max_count': 96, 'd                                                                                                                              escription': 'A Minecraft Server', 'favicon': None, 'online_players': {}}], [],                                                                                                                               [{'ip': '193.141.60.83', 'port': 44959, 'last_seen': 1681504049, 'version': 'Car                                                                                                                              bonSpigot 1.8.8', 'protocol': 47, 'online_count': 0, 'max_count': 32, 'descripti                                                                                                                              on': 'A CloudNet V3 service', 'favicon': None, 'online_players': {}}], [], [], [                                                                                                                              ], [], [{'ip': '5.83.169.207', 'port': 10110, 'last_seen': 1681504054, 'version'                                                                                                                              : 'Spigot 1.8.8', 'protocol': 47, 'online_count': 0, 'max_count': 4, 'descriptio                                                                                                                              n': '§d§lMine§5§lNight§3§l.§c§lde §7- §a§lMinigame Server §7[§51.8-1.13§7]                                                                                                                                       §b§kii §aOpen Beta/Testphase! §b§kiii', 'favicon': None, 'online_players': {}                                                                                                                              }], [{'ip': '31.214.204.36', 'port': 58000, 'last_seen': 1681504088, 'version':                                                                                                                               '1.7.10', 'protocol': 5, 'online_count': 0, 'max_count': 4, 'description': 'Have                                                                                                                               Fun', 'favicon': None, 'online_players': {}}, {'ip'...
      index = 180
      statuses = [{'ip': '162.33.24.21', 'port': 25565, 'last_seen': 1681504050,                                                                                                                               'version': '1.7.10', 'protocol': 5, 'online_count': 0, 'max_count': 20, 'descri                                                                                                                              ption': 'You high?', 'favicon': None, 'online_players': {}}, {'ip': '173.205.81.                                                                                                                              212', 'port': 25584, 'last_seen': 1681504087, 'version': '1.7.10', 'protocol': 5                                                                                                                              , 'online_count': 0, 'max_count': 24, 'description': 'A Minecraft Server', 'favi                                                                                                                              con': None, 'online_players': {}}, {'ip': '149.202.88.35', 'port': 25568, 'last_                                                                                                                              seen': 1681504115, 'version': 'PaperSpigot 1.8.8', 'protocol': 47, 'online_count                                                                                                                              ': 0, 'max_count': 150, 'description': '§6§lSylens Practice FR §8§l❖ §fmc.sylens                                                                                                                              .fr\n §7➥ §aFFA §8┃ §bSkywars §8┃ §e2v2 Ranked §8┃ §dLMS §7» §f[1.8+]', 'favicon                                                                                                                              ': None, 'online_players': {}}, {'ip': '146.59.52.126', 'port': 25587, 'last_see                                                                                                                              n': 1681504131, 'version': 'WineSpigot 1.8.8', 'protocol': 47, 'online_count': 1                                                                                                                              , 'max_count': 300, 'description': 'A Minecraft Server', 'favicon': None, 'onlin                                                                                                                              e_players': [{'name': 'Piotrekxlipa', 'uuid': 'f465dcbf-e...
      current_server_index = 773
      server = ('109.239.144.144', 27665)
      ip = '109.239.144.144'
      port = 27665
      status = None
      clean_status = {'ip': '51.195.120.87', 'port': 25565, 'last_seen': 1681504                                                                                                                              208, 'version': '1.7.10', 'protocol': 5, 'online_count': 1, 'max_count': 120, 'd                                                                                                                              escription': 'A Minecraft Server', 'favicon': None, 'online_players': [{'name':                                                                                                                               'EdrisTypewrtr', 'uuid': '4d930c82-7808-415e-9f75-2729bc6fd4fa'}]}
      e = IndexError('bytearray index out of range')
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 130, i                                                                                                                              n status
    return self._retry_status(connection, **kwargs)
      self = <mcstatus.server.JavaServer object at 0x7fd570891a50>
      kwargs = {}
      connection = TCPSocketConnection(_addr=Address(host='109.239.144.144', por                                                                                                                              t=27665), _timeout=3, _debug=[1, b'\x00', bytearray(b'\x00')])
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 67, in                                                                                                                               sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
      tries = 3
      args = (<mcstatus.server.JavaServer object at 0x7fd570891a50>, TCPSocketCo                                                                                                                              nnection(_addr=Address(host='109.239.144.144', port=27665), _timeout=3, _debug=[                                                                                                                              1, b'\x00', bytearray(b'\x00')]))
      kwargs = {}
      _ = 2
      last_exc = IndexError('bytearray index out of range')
      exceptions = (<class 'Exception'>,)
      func = <function JavaServer._retry_status at 0x7fd576473c40>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 63, in                                                                                                                               sync_wrapper
    return func(*args, **kwargs)
      tries = 3
      args = (<mcstatus.server.JavaServer object at 0x7fd570891a50>, TCPSocketCo                                                                                                                              nnection(_addr=Address(host='109.239.144.144', port=27665), _timeout=3, _debug=[                                                                                                                              1, b'\x00', bytearray(b'\x00')]))
      kwargs = {}
      _ = 2
      last_exc = IndexError('bytearray index out of range')
      exceptions = (<class 'Exception'>,)
      func = <function JavaServer._retry_status at 0x7fd576473c40>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 136, i                                                                                                                              n _retry_status
    result = pinger.read_status()
      self = <mcstatus.server.JavaServer object at 0x7fd570891a50>
      connection = TCPSocketConnection(_addr=Address(host='109.239.144.144', por                                                                                                                              t=27665), _timeout=3, _debug=[1, b'\x00', bytearray(b'\x00')])
      kwargs = {}
      pinger = <mcstatus.pinger.ServerPinger object at 0x7fd574ffdad0>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/pinger.py", line 52, in                                                                                                                               read_status
    raw = json.loads(response.read_utf())
      self = <mcstatus.pinger.ServerPinger object at 0x7fd574ffdad0>
      request = Connection(sent=bytearray(b''), received=bytearray(b''))
      start = 1825950.678897968
      response = Connection(sent=bytearray(b''), received=bytearray(b''))
      received = 1825950.678910171
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py"                                                                                                                              , line 262, in read_utf
    length = self.read_varint()
      self = Connection(sent=bytearray(b''), received=bytearray(b''))
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py"                                                                                                                              , line 239, in read_varint
    part = read[0]
      self = Connection(sent=bytearray(b''), received=bytearray(b''))
      result = 0
      i = 0
      read = bytearray(b'')
builtins.IndexError: bytearray index out of range

@PerchunPak
Copy link
Member

I got it. You were right, the server doesn't send the full answer, but only a part.

@PerchunPak
Copy link
Member

Can you also try to catch the error with code from #512?

pip install git+https://github.com/py-mine/mcstatus.git@raise-better-error-if-server-returns-not-a-full-answer

@DAMcraft
Copy link
Contributor Author

Nothing changed, still got the old error

Traceback with variables (most recent call last):
  File "/root/ServerSeeker/scan.py", line 43, in scan_chunk
    status = JavaServer.lookup(f"{ip}:{port}").status()
      chunked_servers = [('129.159.33.62', 25566), ('51.222.86.39', 25565), ('45.137.246.98', 25945), ('71.65.248.57', 25565), ('161.97.132.235', 26665), ('66.118.234.162', 25565), ('150.136.106.159', 25565), ('31.184.57.178', 25565), ('86.196.184.169', 25565), ('31.214.204.23', 21000), ('51.161.84.145', 40484), ('51.68.215.149', 25565), ('176.57.171.133', 27865), ('5.83.169.48', 10090), ('155.94.165.44', 25565), ('149.56.243.189', 2252), ('51.158.170.237', 25565), ('198.23.203.91', 25565), ('5.83.168.228', 11100), ('91.200.103.90', 25565), ('23.92.26.208', 25565), ('5.83.172.157', 16600), ('51.89.44.128', 25565), ('38.146.80.12', 25565), ('212.118.196.206', 25565), ('51.79.225.249', 25565), ('162.33.27.54', 25565), ('67.185.72.172', 25566), ('144.217.203.143', 25624), ('176.149.184.26', 25565), ('89.35.49.36', 25586), ('195.82.159.250', 12400), ('84.156.118.28', 25565), ('158.69.18.104', 25565), ('204.216.221.166', 25565), ('45.159.6.65', 25582), ('161.97.146.176', 34565), ('51.68.204.158', 25592), ('192.99....
      res = [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, Non...
      index = 110
      statuses = [{'ip': '176.57.160.18', 'port': 28565, 'last_seen': 1681546403, 'version': '1.7.10', 'protocol': 5, 'online_count': 0, 'max_count': 20, 'description': 'Medellin Sky', 'favicon': None, 'online_players': {}}, {'ip': '158.101.0.123', 'port': 25565, 'last_seen': 1681546436, 'version': '1.7.10', 'protocol': 5, 'online_count': 0, 'max_count': 20, 'description': 'GT New Horizons 2.2.3', 'favicon': None, 'online_players': {}}, {'ip': '45.81.232.139', 'port': 44960, 'last_seen': 1681546484, 'version': 'PaperSpigot 1.8.8', 'protocol': 47, 'online_count': 0, 'max_count': 2, 'description': 'The Hobbit', 'favicon': None, 'online_players': {}}]
      current_server_index = 192
      server = ('34.84.62.58', 25565)
      ip = '34.84.62.58'
      port = 25565
      status = None
      clean_status = {'ip': '45.81.232.139', 'port': 44960, 'last_seen': 1681546484, 'version': 'PaperSpigot 1.8.8', 'protocol': 47, 'online_count': 0, 'max_count': 2, 'description': 'The Hobbit', 'favicon': None, 'online_players': {}}
      e = IndexError('bytearray index out of range')
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 130, in status
    return self._retry_status(connection, **kwargs)
      self = <mcstatus.server.JavaServer object at 0x7fa6846c1390>
      kwargs = {}
      connection = TCPSocketConnection(_addr=Address(host='34.84.62.58', port=25565), _timeout=3, _debug=[0, bytearray(b'')])
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 67, in sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
      tries = 3
      args = (<mcstatus.server.JavaServer object at 0x7fa6846c1390>, TCPSocketConnection(_addr=Address(host='34.84.62.58', port=25565), _timeout=3, _debug=[0, bytearray(b'')]))
      kwargs = {}
      _ = 2
      last_exc = IndexError('bytearray index out of range')
      exceptions = (<class 'Exception'>,)
      func = <function JavaServer._retry_status at 0x7fa69de97ba0>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 63, in sync_wrapper
    return func(*args, **kwargs)
      tries = 3
      args = (<mcstatus.server.JavaServer object at 0x7fa6846c1390>, TCPSocketConnection(_addr=Address(host='34.84.62.58', port=25565), _timeout=3, _debug=[0, bytearray(b'')]))
      kwargs = {}
      _ = 2
      last_exc = IndexError('bytearray index out of range')
      exceptions = (<class 'Exception'>,)
      func = <function JavaServer._retry_status at 0x7fa69de97ba0>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 136, in _retry_status
    result = pinger.read_status()
      self = <mcstatus.server.JavaServer object at 0x7fa6846c1390>
      connection = TCPSocketConnection(_addr=Address(host='34.84.62.58', port=25565), _timeout=3, _debug=[0, bytearray(b'')])
      kwargs = {}
      pinger = <mcstatus.pinger.ServerPinger object at 0x7fa68448f0d0>
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/pinger.py", line 49, in read_status
    if response.read_varint() != 0:
      self = <mcstatus.pinger.ServerPinger object at 0x7fa68448f0d0>
      request = Connection(sent=bytearray(b''), received=bytearray(b''))
      start = 1868244.35431267
      response = Connection(sent=bytearray(b''), received=bytearray(b''))
      received = 1868244.59205943
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py", line 239, in read_varint
    part = read[0]
      self = Connection(sent=bytearray(b''), received=bytearray(b''))
      result = 0
      i = 0
      read = bytearray(b'')
builtins.IndexError: bytearray index out of range

@PerchunPak
Copy link
Member

PerchunPak commented Apr 15, 2023

Yes, because this is a debug version. I pushed a new branch, use

pip install git+https://github.com/py-mine/mcstatus.git@raise-better-error-if-server-returns-not-a-full-answer

@DAMcraft
Copy link
Contributor Author

Worked!

[Scanner]     14:43:53: Traceback:
Traceback (most recent call last):
  File "/root/ServerSeeker/scan.py", line 43, in scan_chunk
    status = JavaServer.lookup(f"{ip}:{port}").status()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 130, in status
    return self._retry_status(connection, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 67, in sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
    ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/utils.py", line 63, in sync_wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/server.py", line 136, in _retry_status
    result = pinger.read_status()
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/pinger.py", line 52, in read_status
    raw = json.loads(response.read_utf())
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py", line 270, in read_utf
    length = self.read_varint()
             ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py", line 248, in read_varint
    part = self.read(1)[0]
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mcstatus/protocol/connection.py", line 452, in read
    raise IndexError(f"Not enough data to read! {len(self.received)} < {length}")
IndexError: Not enough data to read! 0 < 1

@DAMcraft
Copy link
Contributor Author

Nevermind, reopen this
image
my scanner found around 320 THOUSAND servers before, now its only 7 thousand. This happens since I updated to the new version yesterday (#511 (comment)), my logs show this happened after about 19:36, so approximatley when I installed the new version :/

@DAMcraft DAMcraft reopened this Apr 15, 2023
@PerchunPak
Copy link
Member

PerchunPak commented Apr 15, 2023

Do you have any logs with errors? If so, it'd be really nice to create some kind of graph of what errors were raised (this also could help us with #307). You can also just send it in raw format.

@PerchunPak
Copy link
Member

Anyway, I reproduced it. The traceback is

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2022.1.4\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 2, in <module>
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\server.py", line 164, in status
    return self._retry_status(connection, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\utils.py", line 53, in sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
    ^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\utils.py", line 49, in sync_wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\server.py", line 170, in _retry_status
    result = pinger.read_status()
             ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\pinger.py", line 67, in read_status
    response = self.connection.read_buffer()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\protocol\connection.py", line 140, in read_buffer
    length = self.read_varint()
             ^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\protocol\connection.py", line 68, in read_varint
    part = self.read(1)[0]
           ^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\protocol\connection.py", line 220, in read
    raise IOError("Server did not respond with any information!")
OSError: Server did not respond with any information!

I also found that this error is on v11 but not on v10, so I ran git bisect and found that 5ceb309 is the bad commit. The problem, is that we actually spam with connections and a server blocks us. We spam, because we have a retry decorator on our status (see here). If remove it, we can get the real traceback:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2022.1.4\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 2, in <module>
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\server.py", line 164, in status
    return self._retry_status(connection, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\server.py", line 170, in _retry_status
    result = pinger.read_status()
             ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\pinger.py", line 75, in read_status
    return JavaServerResponse.build(raw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\status_response.py", line 124, in build
    _validate_data(raw, "status", [("players", dict), ("version", dict), ("description", str)])
  File "C:\Users\perch\Desktop\programming\mcstatus\mcstatus\status_response.py", line 62, in _validate_data
    raise TypeError(
TypeError: Invalid status object (expected 'description' to be <class 'str'>, was <class 'dict'>)

Which shows the problem, that we looked for: Our extraneous validation is incorrect. I will count as a fix, removing it entirely.


P.S. DB with most raised errors would really help us with #307, so we will appreciate if you will send us it even if the bug is resolved. If you are not willing to write such a collector, please DM me.

@PerchunPak
Copy link
Member

@DAMcraft would be great if you will try the patch

pip install git+https://github.com/PerchunPak/mcstatus.git@remove-type-validation-in-status

@kevinkjt2000 kevinkjt2000 removed the meta: Not Enough Information Further clarification is needed label Apr 17, 2023
@PerchunPak
Copy link
Member

Reopening this, as #515 should be merged too before closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
4 participants