Repository: voxel51/fiftyone

Issue:
[BUG] Fiftyone v0.21.6 localhost Not found, while v0.21.4 Could not connect session, despite working before 7Aug23
### System information

-   **OS Platform and Distribution** (`Windows 11 Pro, build 22621.2134`)
-  **Google Chrome** (`Version 115.0.5790.171 (Official Build) (64-bit)`)
-   **Python version** (`python --version 3.10.0`)
-   **FiftyOne version** (`fiftyone --version 0.21.4`)
-   **FiftyOne installed from** (`pip`)

### Commands to reproduce

I have my own custom Python script (including option to run fiftyone's quickstart) working for weeks at least until 7 Aug 2023. I'm unable to share the custom scripts.

Today (17 Aug 2023), as I run through installing fiftyone and running my scripts, I encounter the following problems.

I had a few updates to Google Chrome browser in these 10 days too.

### Describe the problem

Here's what i've tried.

Scenario A: fiftyone v0.21.6
Problem: `App launched. Point your browser to http://localhost:5151`. But unable to load App page at localhost 5151 ("Not found" displayed on page)
Solutions tried but did not work: [Registry settings](https://github.com/voxel51/fiftyone/issues/2010) and/or [mimetype](https://github.com/voxel51/fiftyone/issues/2522#issuecomment-1416318362)

Scenario B: fiftyone v0.21.4
Problem: unable to fully display the App (it only shows the fiftyone skeleton page with "Select Dataset", and no layout and data in the middle). The terminal repeatedly gives `could not connect session, retrying in 10 seconds`.

I'm unsure what is the cause to the above and would appreciate your assistance. 

### What areas of FiftyOne does this bug affect?

-   [x] `App`: FiftyOne application issue
-   [ ] `Core`: Core Python library issue
-   [ ] `Server`: FiftyOne server issue

### Willingness to contribute

The FiftyOne Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the FiftyOne codebase?

-   [ ] Yes. I can contribute a fix for this bug independently
-   [ ] Yes. I would be willing to contribute a fix for this bug with guidance from the FiftyOne community
-   [x] No. I cannot contribute a bug fix at this time



Discussion:
Update: 

Scenario B is solved by downgrading Fiftyone to v0.21.4 (which has worked previously for me). Follow the steps here: https://docs.voxel51.com/getting_started/install.html#downgrading-fiftyone

However, Scenario A with Fiftyone v0.21.6 still gives the same problems as described above.
Hi @JoyLinWQ. These errors usually mean the App server is shutting down prematurely. Since you are running an App session from a script, can you confirm you are using [`session.wait()`](https://docs.voxel51.com/api/fiftyone.core.session.html#fiftyone.core.session.Session.wait)?

No obvious changes have been made recently to the server, other than a change in the [starlette requirement](https://github.com/voxel51/fiftyone/pull/3297).

To debug further, starting the server directly with `python path/to/fiftyone/main.py` should reveal more.


@benjaminpkane I seem to be hitting this in a Teams install of v0.13.6 (scenario A)
@allenleetc This [change](https://github.com/voxel51/fiftyone/pull/3338/commits/ee2001bb1a9bb713f2277f359b0547ce8048cedd) may be the issue, if you're able to change the source to `follow_symlink=False` we can confirm
@benjaminpkane changing to `follow_symlink=False` on L115 did resolve for me
> Hi @JoyLinWQ. These errors usually mean the App server is shutting down prematurely. Since you are running an App session from a script, can you confirm you are using [`session.wait()`](https://docs.voxel51.com/api/fiftyone.core.session.html#fiftyone.core.session.Session.wait)?
> 
> No obvious changes have been made recently to the server, other than a change in the [starlette requirement](https://github.com/voxel51/fiftyone/pull/3297).
> 
> To debug further, starting the server directly with `python path/to/fiftyone/main.py` should reveal more.

@benjaminpkane This is what i can share in my `main.py`, where the `run_viz()` contains some basic snippet obtained from fiftyone documentation on configuring spaces, panels, etc to display the App. 
```
def main():
    dataset = foz.load_zoo_dataset(name="quickstart")
    dataset, spaces = run_viz(
            task="quickstart",
            dataset=dataset,
            gt_field="ground_truth"
    )
    return dataset, spaces

if __name__ == "__main__":
    dataset, spaces = main()
    session = fo.launch_app(dataset=dataset, spaces=spaces)
    session.wait()
```

I have used `pip install fiftyone==0.21.6` and not git clone from the repo directly.

Could you please guide how i can find the `path/to/fiftyone/main.py` to start the server directly, as i dont find any `main.py` in the fiftyone folder (it only has the quickstart datasets etc). Thank you.
Hi @JoyLinWQ. We've discovered the issue. It looks like some installs are not working with a new [`follow_symlinks`](https://github.com/voxel51/fiftyone/pull/3338/commits/ee2001bb1a9bb713f2277f359b0547ce8048cedd) change. I can recommend downgrading to `0.21.4` until a patch is out
Thank you @benjaminpkane , appreciate your prompt response. Will definitely follow your recommendation for now. 

Resolving patch:
diff --git a/fiftyone/server/app.py b/fiftyone/server/app.py
--- a/fiftyone/server/app.py
+++ b/fiftyone/server/app.py
@@ -112,7 +112,6 @@ async def dispatch(
             app=Static(
                 directory=os.path.join(os.path.dirname(__file__), "static"),
                 html=True,
-                follow_symlink=True,
             ),
             name="static",
         ),


Test patch: