Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.apache.hadoop.mapreduce.v2.app.AppContext;
import org.apache.hadoop.yarn.webapp.WebApp;

import com.google.inject.Singleton;

import javax.servlet.Filter;

/**
Expand All @@ -38,6 +40,7 @@ public AMWebApp(AppContext appContext) {

@Override
public void setup() {
bind(App.class).in(Singleton.class);
bind(AppContext.class).toInstance(appContext);
Comment on lines 42 to 44

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the attempts page. The App binding should be request-scoped rather than singleton-scoped.

App contains mutable request-specific state through setJob() and setTask(). Binding it as a Singleton allows concurrent or subsequent requests to overwrite or reuse another request's job/task state. The controller and the rendered view need to share the same App instance only within a single HTTP request.

Could you please use:

  bind(App.class).in(RequestScoped.class);

with com.google.inject.servlet.RequestScoped?

It would also be helpful to add a regression test that starts the AM WebApp and requests /mapreduce/attempts/<job_id>/m/SUCCESSFUL, since the existing page tests do not exercise the real AMWebApp Guice lifecycle.

route("/", AppController.class);
route("/app", AppController.class);
Expand Down
Loading