Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flattening a lot of fired Deferreds causes a RecursionError #10125

Closed
twisted-trac opened this issue Mar 11, 2021 · 3 comments
Closed

flattening a lot of fired Deferreds causes a RecursionError #10125

twisted-trac opened this issue Mar 11, 2021 · 3 comments

Comments

@twisted-trac
Copy link

pwestlak-xilinx's avatar @pwestlak-xilinx reported
Trac ID trac#10125
Type defect
Created 2021-03-11 12:11:12Z

This gives a recursion error after printing 197 lines:

import sys
from twisted.internet import reactor, defer, task
from twisted.web.template import flatten

def output(stuff):
    sys.stdout.write(stuff.decode())

def sync(reactor):
    return flatten(None, [defer.succeed(str(i)+'\n') for i in range(1000)], output)

task.react(sync)
Searchable metadata
trac-id__10125 10125
type__defect defect
reporter__pwestlak_xilinx pwestlak-xilinx
priority__high high
milestone__None None
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__web web
keywords__None None
time__1615464672713574 1615464672713574
changetime__1617444162694748 1617444162694748
version__None None
owner__glyph glyph

@twisted-trac
Copy link
Author

glyph's avatar @glyph commented

In review at https://github.com/twisted/twisted/pull/1549/files

@twisted-trac
Copy link
Author

wsanchez's avatar @wsanchez set owner to @glyph

Looks good

@twisted-trac
Copy link
Author

glyph's avatar @glyph set status to closed

In changeset 12d53db

#!CommitTicketReference repository="" revision="12d53dbd106e424425137c29ab3b9cf2a5e2bf34"
Merge pull request #1549 from twisted/10125-template-recursion-error

Author: glyph

Reviewer: wsanchez,pwestlak-xilinx

Fixes: ticket:10125

Fix and simplify trampoline for twisted.web.template flattening to avoid RecursionErrors with synchronous deferreds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants