EiffelWebFramework / EWF

Eiffel Web Framework -- Provide a common framework to build easily web server application in Eiffel (portable on various connector and platforms)
http://eiffelweb.projects.eiffel.org/
Other
44 stars 26 forks source link

Segmentation Fault on map_uri_template_agent_with_request_methods #159

Closed federeghe closed 9 years ago

federeghe commented 10 years ago

This is not an high priority bug, but if you call map_uri_template_agent_with_request_methods with a Void agent, when a request arrives a Segmentation Fault happens. It's quite hard to debug what happened until you realize that you have passed a Void agent. Probably a "require" somewhere that raises a Void Target can be very useful.

Example:

myobject : MY_CLASS -- Not initialized
(...)
feature
    map_uri_template_agent_with_request_methods ("/test", agent myobject.mymethod, router.methods_get)

Attached the call stack of segmentation fault. screenshot from 2014-11-27 22 05 36 .

jocelyn commented 10 years ago

Hi,

You are right there should be an assertion. I will update code soon to catch those kind of errors, unless you already have the changes and about to create a pull request. We welcome any kind of contributions. This issue report is already appreciated.

Otherwise, I would recommend to compile using "void-safe" mode, and such issue with Void reference will be catched at compilation time. In EWF code, all type declaration are attached by default, and then, when a variable or attribute is accepting Void, it is marked with "detachable".

If you are not aware about Eiffel void-safety mode, let me know, and I will share a few link to learn about it. (With recent version of EiffelStudio, this is the default compilation mode).

federeghe commented 10 years ago

Thank you, we are working on small university project using Eiffel. We started without using void-safe mode (and this was probably a bad choice), but it remains only 10 days to complete the project and refactoring the code now can be complicated :) For future projects, I'll use for sure void-safe compilation.

I would have tried to add the assertion, but I don't really know how agents work, and at present it's hard for me to hack EWF code.

jocelyn commented 10 years ago

Ok I understand. And yes you are right, for next project, I highly recommend you to start directly with full void-safety. This is really really a time saver, and improve quality of code.

About adding assertion, ok I will do that, but here this has nothing to deal with agent ... in this case an agent is just a PROCEDURE or FUNCTION object, as any other object.

I will let you know, when this is done, so that you can see this is a simple task.

Thanks for contributing by reporting an issue or requesting improvements. Regards, -- Jocelyn

On Thu, Nov 27, 2014 at 11:39 PM, Federico Reghenzani < notifications@github.com> wrote:

Thank you, we are working on small university project using Eiffel. We started without using void-safe mode (and this was probably a bad choice), but it remains only 10 days to complete the project and refactoring the code now can be complicated :) For future projects, I'll use for sure void-safe compilation.

I would have tried to add the assertion, but I don't really know how agents work, and at present it's hard for me to hack EWF code.

— Reply to this email directly or view it on GitHub https://github.com/EiffelWebFramework/EWF/issues/159#issuecomment-64835036 .

jocelyn commented 9 years ago

see commit https://github.com/EiffelWebFramework/EWF/commit/f14fdc2a69e1f71db8a894eb0e3903289e21abfb