I have a rule that redirects a user to the user profile page (a panel actually) after a new content is saved. It worked before February 25th update (of Rules and Entity API).

Now, if a new content is saved through the overlay, it loops and crashes Apache (Segmentation fault in web server logs) several times (until the browser is not able to load the page anymore) creating at least 3 new nodes. If the same rule is triggered when content is created without the overlay, redirect works, no loops or crashes.

Comments

burlap’s picture

Component: Rules Core » Rules Engine
Category: bug » support
Status: Active » Closed (works as designed)

It seems that this is an issue with my apparently misconfigured test environment...

findorf’s picture

Hi Burlap,

Could you tell a bit more about how you solved it?
I'm having the same error, if I edit a node in an overlay. My Rules module redirect does not work.
WAMP returns "Connection was reset".

burlap’s picture

I don't remember anymore. It might have been related to creating a host alias on my test server and wrong configuration of virtual hosts.

vthirteen’s picture

would you ever remember that, please let us know :-)

burlap’s picture

It could have been that sendmail was missing and the rule in question included sending mail.

vthirteen’s picture

disabling Overlay made my redirect rule working again.

jmix’s picture

hi, same problem here... disabling overlay works, it seems that there's no other solution for now...

scor’s picture

Status: Closed (works as designed) » Active

I'm also experiencing the same with the node creation form in an overlay and a rule with a redirect. The form takes a while to get submitted, the httpd process spikes to 100% and in my logs I can find Maximum execution time of 30 seconds exceeded. Loop. In the end I end up being redirected twice (I can see that because I also have messages displayed, and they appear for a second and then the redirects kick in again). I bet the double redirect might go away once the overlay problem is fixed. I don't experience to problem if I got to the non-overlay form.

rylowry@gmail.com’s picture

It looks like I'm having the same problem. My rule is set up to perform a page redirect to a view after a node is created or updated. When adding new content, I end up with a Firefox error message:

The connection was reset
The connection to the server was reset while the page was loading.

When I visit the view I was supposed to be redirected to (just list of nodes of a particular content type) I can see that the node I just tried to create was actually created twice.

When I edit an existing node, I don't see a browser error, but a Drupal error message appears at the top of the form. It reads:

The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.

When I perform either action without the overlay, they both work as expected.

dave kopecek’s picture

I'm getting a similar result as above:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.

When adding nodes in the admin overlay:
http://www.mysite.org/user/369/my-info#overlay=node/add/info

I've got the following rule defined to route the user back to user/me/my-info:

{ "rules_redirect_to_my_info_after_info_add" : {
    "LABEL" : "Redirect to My Info after info add",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_insert" ],
    "IF" : [
      { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "info" : "info" } } } }
    ],
    "DO" : [
      { "redirect" : { "url" : "user\u002Fme\u002Fmy-info", "destination" : 1 } }
    ]
  }
}
ohthehugemanatee’s picture

Reporting the same issue. I'm not clear if it's a problem with Rules or with Overlay, though.

I'm running MAMP with PHP 5.3. Nothing special or unusual.

There's nothing about the crash in Drupal logs. In php error log:

[24-May-2012 09:48:26] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /users/ohthehugemanatee/Sites/foo/includes/database/database.inc on line 2165

In Apache error log:

[Thu May 24 15:47:08 2012] [notice] child pid 43852 exit signal Segmentation fault (11)

Steps to reproduce

1) create a rule that redirects the user after saving content.
2) enable Overlay for node/add and node/edit pages
3) create a node.

Observed behavior:

* webserver loop which eventually times out.

Expected behavior:

* redirect per the Rule configuration.

ohthehugemanatee’s picture

Priority: Normal » Major

On reflection, an interaction between a default core module (overlay) and a core Rules action (redirect) that causes a segfault in your webserver is a big deal. Raising the priority to major.

ohthehugemanatee’s picture

Further investigation: this seems to be caused by the two subsystems trying to set the destination URL parameter. I could get around the issue by removing the Rule and using a form_alter to do the redirect with the destination parameter instead.

dmegatool’s picture

Same here. My rule is working if the overlay isn't used and crash if it's enabled.

ConradFlashback’s picture

Component: Rules Engine » Rules Core

+1 same #11 problem

iterator’s picture

Same here (#11)

mikemadison’s picture

Here as well.

attisan’s picture

big issue for me too ... would really need a solution on this (disabling either overlay or rules are no option in my case) ...

raulo’s picture

I have the same problem with Xammp, but I got no problem in Wamp

codesidekick’s picture

Same issue over here. Looks like it's form_alter time.

mkostir’s picture

I have also temporarily sorted this problem out by disabling overlay, however I am hoping for a better solution. Has there been any development of this issue since the last post? Thanks for any hint.

tobiasb’s picture

Hermes22’s picture

Same issue here, no way i can acces the overlay trough the rules redirect. When turning off overlay, the redirect seemed to work again.

maen’s picture

I second that!

MickL’s picture

same issue. still not fixed. cant redirect from overlay :(

MickL’s picture

Version: 7.x-2.x-dev » 7.x-2.3
Category: support » bug
owntheweb’s picture

I'm having the same issue. It all works like a charm after disabling the overlay. I miss the overlay...

cgdrupalkwk’s picture

Same problem here. Any ideas to fix? I'd sponsor one if anyone has a solution.

demian1111’s picture

Getting the same thing.

fago’s picture

MickL’s picture

In my opinion this 2 year old bug should definitiley be fixed. #28 I would donate for it, too.

cgdrupalkwk’s picture

Does anyone have an idea to fix this? I don't have the ability but do have the $ to compensate someone for their time and it sounds like #31 will also help. Please let me know if you're interested!

mrvee’s picture

Experiencing the same issue. Have disabled overlay for now. Would really like to turn it back on.

milos.kroulik’s picture

If you're still looking for temporary solution, look at http://stackoverflow.com/questions/9011882/close-overlay-and-redirect-to... Combination of these answers solved my use case.

yenidem’s picture

I want to update this issue because I have same problem, please fix this bug.
Thank you.

ytsejam’s picture

Having the same problem.

ytsejam’s picture

I also managed to do a hook workaround as mentioned above. This is a custom module named "overlayclose":

<?php
function overlayclose_form_node_form_alter(&$form, &$form_state){
	$form['actions']['submit']['#submit'][] ='overlayclose_callback';
}
function overlayclose_callback(&$form, &$form_state) {
	unset($_GET['destination']);
	$form_state['redirect'] = FALSE;
	drupal_set_message("Content added successfully.");
	overlay_close_dialog();
}

It essentially hooks to all the node creation forms, inserts a new callback function which unsets the destination and stops redirect. But you also have to refresh the page in order to get the system message that your content has been successfully added, so I finished it with a static second message "Content added successfully" which also refreshes the page. So you get two messages, but it gets the job done.

However, I'd much prefer to be able to do it with rules.

ConradFlashback’s picture

Issue summary: View changes

3 years for this bug!?! :(
Rules page redirect is not compatible with overlay, that incredible.
Any news?

drupa11y’s picture

I´m not sure if this is a Rules bug. I have a similar issue and in our case the "form" prevents rules I guess from working:

<form class="overlay-processed" action="/transfere_points/543?render=overlay&amp;render=overlay" method="post" id="userpoints-donation-giveform" accept-charset="UTF-8">...

On another case it works:

<form class="node-form node-inserate-form ds-1col overlay-processed" enctype="multipart/form-data" action="/node/1343/edit?destination=user%2Fme&amp;render=overlay&amp;render=overlay" method="post" id="inserate-node-form" accept-charset="UTF-8">

Unfortunately I´m no programmer an could no say why.
In the 2nd example within the rule it´s set "add redirect url as parameter".

vasekc’s picture

Any news on that? :/

cscott5288’s picture

So like, no solution after 3 years?

dureaghin’s picture

In my project I do not use redirect rules to pages, but web server still crashing after saving new content + Overlay and not all the time just once a week, maybe this question can be associated with caching. I'll try to debug.

Drupal Core 7.38
Rules 7.x-2.9
Ctools 7.x-1.7
Redis 7.x-2.15

SuperEngineer 64’s picture

+1 #11.

Can anyone post the solution with form_alter? Would be great!

cscott5288’s picture

I've gotten redirects to work on overlays with the following hook:

function YOUR_MODULE_OR_THEME_NAME_form_alter(&$form, &$form_state, $form_id)
// redirect every form except map content type which goes to the map node
{
    if($form_id != 'THE_FORM_ID') { // REMOVE THIS IF STATEMENT IF YOU WANT IT TO WORK ON ALL FORMS
        $form['actions']['submit']['#submit'][] = 'YOUR_MODULE_OR_THEME_NAME_redirect_handler';
    }
}

function YOUR_MODULE_OR_THEME_NAME_redirect_handler($form, &$form_state)
{
    unset($_REQUEST['destination']); 
    unset($form['#redirect']); 

    $form_state['redirect'] = '/url_redirected_to';
        $form['#redirect'] = '/url_redirected_to';

}
hessam61’s picture

I couldn't get this code to work. What did you add for destination?

Yuri’s picture

Just wondering if anyone has come across a reasonable solution for this Major issue since it was first posted on 27 Feb 2011 ? Solutions mentioned above did not work for me.