The GitHub Actions job "CI" on grails-core.git/fix/gorm-service-readonly-8.0.x 
has succeeded.
Run started by GitHub user codeconsole (triggered by codeconsole).

Head commit for run:
608b8ea0a8b815b0abe4cb5fd23ba6417133bd7d / Scott Murphy Heiberg 
<[email protected]>
Do not open a transaction for scaffold service reads

GormService carries a class-level @ReadOnly, so the transactional AST
transform wraps get/list/count in a GrailsTransactionTemplate. With the
default REQUIRED propagation, a read taken outside an existing
transaction becomes the outermost transaction, and committing it flushes
the session: DatastoreTransactionManager.doCommit skips its own flush
when the transaction is read-only, then calls transaction.commit(), and
MongoTransaction.commit() flushes unconditionally.

A read can therefore write. When one of these reads runs inside a flush
— a referential check in a validator, or a beforeInsert hook — the
commit re-validates the entity being saved, the validator reads again,
and the cycle repeats until the stack is exhausted.

The annotation is also redundant where scaffolded reads are actually
served: RestfulServiceController already declares @ReadOnly at class
level, so that path keeps its read-only boundary either way. The service
annotation only takes effect when the service is called outside one,
which is precisely where opening and committing a transaction is
unwanted.

The write methods keep their own @Transactional.

Report URL: https://github.com/apache/grails-core/actions/runs/32785046444

With regards,
GitHub Actions via GitBox

Reply via email to