iOS - 错误消息“设备上没有剩余空间" [英] iOS - Error message "no space left on device"

查看:45
本文介绍了iOS - 错误消息“设备上没有剩余空间"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们突然遇到一个似乎与 iOS 14 相关的问题,因为我们在之前的版本中没有出现这些错误.

We suddenly experience a problem that somehow seems to be related to iOS 14 as we haven't had those errors in prior versions.

在应用启动时,我们对不同的网络服务进行了大量网络请求.在用户完全登录之前,总共需要 158 个 GET、POST 和 PUT 请求.在此之前,该应用程序使用 260MB 的内存.当用户切换到不同的帐户时,登录过程将再次启动,并发出另外 158 个请求.现在,如果用户再次决定使用新帐户登录,则登录过程将再次开始.但这一次,网络请求随机开始取消,并显示以下错误消息:

At app start, we do quite a lot of network requests to different webservices. This sums up to 158 GET, POST and PUT requests until a user is fully logged in. The app uses 260MB of memory until then. When a user switches to a different account, the login process starts again and another 158 requests are sent out. Now if the user again decides to login with a new account, the login procedure starts yet again. But this time, network requests randomly start canceling with such error messages:

Error Domain=NSPOSIXErrorDomain Code=28 "No space left on device" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <EA2DAE7D-F7AD-4979-8215-E716163FA725>.<1>, _kCFStreamErrorDomainKey=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <EA2DAE7D-F7AD-4979-8215-E716163FA725>.<1>"), _kCFStreamErrorCodeKey=28} 

因此,在两分钟和大约 400 - 500 个 HTTP 请求的时间范围内,网络层由于内存空间不足而开始取消这些请求.虽然可以用完 3GB.

So within a timeframe of two minutes and approximately 400 - 500 HTTP requests, the network layer starts canceling those due to a lack of memory space. Although it could use up 3GB.

应用网络逻辑在我们开始遇到此类错误之前和之后都没有太大变化.我们也只使用一个 SessionManager 实例.在我看来,网络堆栈似乎会被请求数量淹没,因此开始取消它们.也许iOS 14在这方面变得更加严格?有没有其他人可能遇到过类似的问题?

The app network logic hasn't changed much before and after we started experiencing such errors. We are also using one SessionManager instance only. It seems to me as if the network stack would start drowning by the number of requests and therefore starts canceling them. Perhaps iOS 14 became more strict in such regards? Has anyone else possibly experienced a similar issue?

我们在基本网络层使用 AFNetworking.

We use AFNetworking on our basic network layer.

非常感谢任何帮助.

推荐答案

经过一段时间的调查,结果证明它是我们用于调试目的的库.这个库,DBDebugToolkit,带有我们默认开启的网络记录器功能.在高流量的情况下,网络记录器会迅速增加内存使用量,直到我们的请求被取消.现在它默认关闭,但可以在我们的调试菜单中打开.

After a while of investigation, it turned out to be a library we're using for debugging purposes. This library, DBDebugToolkit, comes with a network logger feature which we had turned on by default. In situations of high traffic, network logger quickly increased memory usage until our requests got canceled. Now it's turned off by default, but can be switched on in our debugging menu.

这篇关于iOS - 错误消息“设备上没有剩余空间"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆