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

Server Reload Fails when Indentation Error is Encountered #2

Closed
ghost opened this issue Apr 10, 2013 · 3 comments
Closed

Server Reload Fails when Indentation Error is Encountered #2

ghost opened this issue Apr 10, 2013 · 3 comments
Assignees

Comments

@ghost
Copy link

ghost commented Apr 10, 2013

The code at https://gist.github.com/amock/bf012ef3c8d83daddbff crashes clastic when reloading with a

ValueError: unrecognized traceback string format.

(Code inlined for the lazy:

from clastic import Application, json_response
def test(request):

routes = [('/test', test, json_response)]

app = Application(routes)
app.serve()

)

@plowman
Copy link
Contributor

plowman commented Apr 10, 2013

I've seen similar behavior with several different compiler errors. The main way it affects me is that sometimes I will save in the middle of a change out of habit, the server will stop, and then I won't notice until I finish my change and go check it out.

The only behavior besides dying would be to not reload unless the code compiles. This would be a little more pleasant for developing, but would also require moving the reloading part of the code from werkzeug.serving into clastic. It also requires running some sort of compile/lint/syntax check on the code without running it (since you can't have two processes with the same socket), but I imagine this is something straightforward in python.

@ghost ghost assigned mahmoud Apr 10, 2013
@mahmoud
Copy link
Owner

mahmoud commented Apr 10, 2013

Well, first off you can definitely have multiple processes with the same socket. Remind me to show you the ways at some point. (aside from fork(), which is aight, here is some cool, but heavy and dry stuff: http://infohost.nmt.edu/~eweiss/222_book/222_book/0201433079/ch17lev1sec4.html)

While not documented yet, Clastic actually does have an error server, which displays an error page without killing the server, it's just that I've only thought to test it with NameErrors and SyntaxErrors, and I forgot about IndentationErrors.

Avoiding reload if the new code doesn't compile was the original intent, but it occurred to me that that sort of robustness is desirable (to some) in production environments, but Clastic's devserver is only for development. In development we want fast failure, hence the current behavior of Flaw (aka the error application).

Anyhoo, I'll push the fix for this ASAP.

@mahmoud
Copy link
Owner

mahmoud commented Apr 11, 2013

closing as invalid/wontfix. try reading the man page next time.

jkfixed in 20e017d . ;D When you get a chance, let me know if that works for you, then I'll push the new version to PyPI.

@mahmoud mahmoud closed this as completed Apr 11, 2013
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

No branches or pull requests

2 participants