Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

SystemStackError on selecting records from MySQL

オープン
#309 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
mysql, ruby
領域
backend, databases

調査の方向性

Start with rom/sql/relation.rb:64 and rom/auto_curry.rb:48, then compare them with the reported caller in lib/lf_webapp/repositories/tenants_user_repository.rb:7. Try to reproduce the recursive auto_curry behavior with composite primary keys on MySQL using the listed versions and deployment conditions. Done means identifying the trigger and verifying a fix, or documenting why the environment is required.

索引モデルが issue の本文から書いたものです。

説明

I'm using rom as ORM with Hanami.
Recently, I noticed that sometimes server hanged up raising SystemStackError.
I dug into stack trace, and found that auto_curry method was called too many times.

Here is part of the trace:

SystemStackError: stack level too deep
  from rom/sql/relation.rb:64:in `by_pk'
  from rom/auto_curry.rb:48:in `block (2 levels) in auto_curry'
         : 509 times in total
  from rom/auto_curry.rb:48:in `block (2 levels) in auto_curry'
  from lib/lf_webapp/repositories/tenants_user_repository.rb:7:in `find'

And here is the caller:

5  def find(tenant_uuid, user_uuid)
6    tenants_users  # tenants_users is the intermediate table for many_to_many association
7      .by_pk(tenant_uuid, user_uuid)
8      .one
9  end

Things that I know at this point are:

  • The error seems to happen at selecting records from table with composite primary keys
  • The error occurs at certain timing after restarting server. Once occurred, it doesn't become normal unless restarting. (requesting count or memory usage may be related?)
  • The error hasn't occurred in local environment.
  • Invoking tenants_user_repository.find method calls auto_curry only once in local env.

Here is the environment:

  • Server: AWS Elastic Container Service on two t2.micro instances with load balancing
  • Deployment: create docker container in CircleCI and push container image to ECS registry
  • Database: AWS RDS t2.micro instance running MySQL 5.7

Versions:

ruby 2.5.1
hanami 1.2.0
sequel 5.6.0
rom 4.1.3
rom-changeset 1.0.1
rom-core 4.1.2
rom-mapper 1.1.0
rom-repository 2.0.2
rom-sql 2.4.0
主要言語
Ruby
スター
220
フォーク
97
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rom-rb/rom-sql のほかの issue

rom-rb/rom-sql の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。