Analysis of Video Playback Failure in ByteDance iOS Client Cache

A bug in ByteDance's iOS client caused 1080p videos to become unplayable after 1 hour 53 minutes due to a downloader component truncating files beyond the int type limit, which was resolved by upgrading to a longlong type.

Byte Quality Assurance Team
Byte Quality Assurance Team
Byte Quality Assurance Team
Analysis of Video Playback Failure in ByteDance iOS Client Cache

【问题反馈】1月2号运营后台收到用户反馈,某应用的《我和我的家乡》影片结尾部分观看不了;经过确认,场景是被下载缓存到本地的电影。

【排查】1 我们首先考虑的是播放器自身的问题,例如播放器在特定视频帧或GOP下的崩溃。但是在线播放的该视频没有接到这样的反馈,所以问题应该跟缓存到本地的过程有关。

2 接下来我们排查了下载源的文件完整性,以及本地文件的完整性。我们发现,源站的文件是完整的,而本地缓存的文件却不完整。

3 所以我们的目光来到了网络库中的下载组件。该组件是字节自研的downloader。此时我们发现,该应用的低版本中,使用了较老版本的downloader;该downloader的研发表示,这个老版本有一个已知问题(已经被后续版本修复):

downloader对获取到的文件长度,使用了int型;这样,超过int长度的文件将会被截断,从而出现文件不完整的情况。这是该bug的根本原因。

【解决】由于该应用升级到新版downloader有困难,涉及到大量回归测试。所以针对旧版本downloader,专门修复了该bug,并且快速集成发布;定位、排查、修复、发布用时大约3天。

【一些后继问题】【int类型到底有多大?】以此次问题为例,1GB=1073741824字节(1KB=1024字节 1M=1024KB 1G=1024MB),int有符号2^31-1=2147483647(约20亿),约为2G。此时如果强制将一个大于2G的视频进行截断,会导致视频的最大值不符合预期,导致失败。修复方案中,将int变为longlong类型,最大为9223372036854775807,可以认为无限大。

【这个Bug为什么没测出来?】该应用上线电影属于运营活动,对于缓存电影的功能,RD同学因为任务紧急,只进行了自测和业务QA回归,未周知网络库QA。而在此之前,由于认为缓存超过2G的文件场景并不存在,所以网络库方面认为这个bug风险不大,也没有要求应用侧升级到新版downloader。

该Bug实际测试时,如果纯粹用手工测试,覆盖难度较大。一方面需要缓存1080p电影到结束,另一方面需要观看到电影结束;单纯缓存该电影,缓存低清画质,或者只播放开头,都是无法发现的。

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

video playbackBug Analysisbackend componentdownloader issuefile truncation
Byte Quality Assurance Team
Written by

Byte Quality Assurance Team

World-leading audio and video quality assurance team, safeguarding the AV experience of hundreds of millions of users.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.