Skip to content

fix(mms): submit again when the modem cuts an upload short - #116

Merged
MddIdd merged 3 commits into
MddIdd:developfrom
zhangsmallchi:fix/mms-send-retry
Sep 25, 2026
Merged

MddIdd merged 3 commits into
MddIdd:developfrom
zhangsmallchi:fix/mms-send-retry

Conversation

@zhangsmallchi

Copy link
Copy Markdown
Contributor

Based on develop (v1.11.0); independent of #103.

Summary

The modem's MMSC socket occasionally answers SEND FAIL part way through an upload. An outgoing MMS was then marked failed at once, with an error that dropped the modem's answer, although the same message sent by hand a moment later went through. This submits such an attempt again, but only when the MMSC cannot have received the whole request, so a message is still never delivered twice.

Changes

  • Transport: MmsTransportError gains unsent -- no connection was made, or the upload stopped before its last chunk. A failure on the last chunk is not unsent, since those bytes may have left the modem.
  • Send: an unsent attempt is submitted again on a fresh connection after 3 and then 10 seconds, then marked failed. A request that went out whole stays "unknown" and is never repeated, as before.
  • Diagnostics: the error carries the modem's answer and the byte offset, e.g. ... (modem answered: SEND FAIL), at byte 2920 of 310544.
  • Docs: CHANGELOG (Unreleased) and the MMS section of TROUBLESHOOTING.

Upgrade impact

  • None. No settings, schema or dependency changes.

Safety and privacy impact

  • No real SIM identity, phone number, PIN, token, subscription URL, message or call data is included (tools/check-subscriber-identifiers.sh --commits clean).
  • Device-changing operations fail closed and report actual state (no device-changing operations added).
  • User-visible changes are documented (CHANGELOG, TROUBLESHOOTING).
  • Python tests pass.

Testing

  • Python tests: 1,342 (6 new) -- a chunk refused mid-upload is unsent and reported with its answer and offset; a refused last chunk is not; a connection that never opens is; send retries and then succeeds; send gives up after its delays; nothing that may have arrived whole is resubmitted.
  • Observed on the test device before the fix: a 303 KB MMS failed five seconds into the upload; the same picture sent 30 s later arrived.
  • On a device: a mid-upload SEND FAIL is followed by a successful resubmission in the log.

中文

基于 develop(v1.11.0);与 #103 无依赖。

概要

模块的 MMSC 连接偶尔会在上传途中返回 SEND FAIL。此前外发彩信会立刻被标记为失败,错误信息里也没有模块的原始答复,而同一条彩信稍后手动重发就能成功。本 PR 在这种情况下自动重发,但只限于 MMSC 不可能收到完整请求的情况,因此仍然不会让对方收到两条。

改动

  • 传输:MmsTransportError 新增 unsent,表示连接没有建立,或上传在最后一块之前就中止。最后一块失败不算 unsent,因为这些字节可能已经离开模块。
  • 发送:unsent 的尝试分别在 3 秒和 10 秒后换新连接重发,仍失败才标记为失败。已经完整发出的请求照旧标记为"未知",不会重发。
  • 诊断:错误信息带上模块的答复和字节位置,例如 ... (modem answered: SEND FAIL), at byte 2920 of 310544。
  • 文档:CHANGELOG(Unreleased)和 TROUBLESHOOTING 的彩信一节。

升级影响

  • 无。没有设置、数据库结构或依赖变化。

安全与隐私影响

  • 不含真实 SIM 身份、电话号码、PIN、令牌、订阅链接、短信或通话数据(tools/check-subscriber-identifiers.sh --commits 通过)。
  • 修改设备的操作失败时关闭并报告实际状态(未新增此类操作)。
  • 用户可见的变化已写入文档(CHANGELOG、TROUBLESHOOTING)。
  • Python 测试通过。

测试

  • Python 测试:1,342 个(新增 6 个)——上传途中被拒的分块标记为 unsent 并报告答复和位置;最后一块被拒不算;连接未建立算;发送重试后成功;重试次数用完后放弃;可能已完整到达的请求不重发。
  • 修复前在测试机上观察到:一条 303 KB 的彩信在上传 5 秒后失败,30 秒后重发同一张图片成功送达。
  • 在设备上:日志中出现上传途中 SEND FAIL 之后重发成功。

🤖 Generated with Claude Code

The modem's MMSC socket occasionally answers SEND FAIL part way through an
upload. The MMS was then marked failed with a message that dropped the
modem's answer, and the same message sent by hand a moment later went
through: on the test line a 303 KB picture failed after five seconds and a
297 KB one sent thirty seconds later arrived.

A transport error now says whether the MMSC cannot have received the whole
request: no connection was made, or the upload stopped before its last
chunk. Such an attempt is submitted again on a fresh connection after 3 and
then 10 seconds. A failure on the last chunk is not repeated, since those
bytes may have left the modem, and a request that went out whole remains
"unknown" and is never sent twice. The error carries the modem's answer and
the offset where the upload stopped, so the next failure can be told apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MddIdd and others added 2 commits September 25, 2026 22:12
…oad deadline

The request deadline scales with the upload size, so a connection that never
opened held the modem, and every retry of it, for that long.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MddIdd
MddIdd merged commit 2083e24 into MddIdd:develop Sep 25, 2026
6 checks passed
@MddIdd MddIdd mentioned this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants