chrismcg

chrismcg

I’ve upgraded an Phoenix 1.1.4 app to use Ecto 2.0 and wanted to try adding acceptance tests before upgrading to 1.2. I followed the instructions in the Wallaby repo and got concurrent tests going with the Phoenix.Ecto.SQL.Sandbox plug. However I’ve run into a problem I’m not sure how to solve other than by switching back to sequential tests.

The page my acceptance tests loads connects to a channel (UserChannel), and in the authorized? function there I query the database as part of authorisation. This triggers a ** (RuntimeError) cannot find ownership process for #PID<0.xxx.0>. I assume this is because of the way the the process handling the channel is started?

The web request and the websocket request both have the extra metadata in the UA string that phoenix_ecto uses to allow them access to the connection but I don’t see how to pass this through to the created channel processes.

My app starts or finds a named GenServer when a channel is joined, and that also talks to the database to manage state. Is there a way I can add this process to the ones allowed access to the connection too?

For now I’ve set async: false and put the Repo into shared mode.

Showing Posts 1 to 1

hubertlepicki

hubertlepicki

Check out this issue:

https://github.com/elixir-lang/ecto/issues/1319

I thnk this works in the way that there’s a plug that shares the connection used in test with the one used in request handlers. But Phoenix handles the requests in different processes (and even different process subtree) than channels. So the ownership is not extended automatically to any other processes.

This is an issue not only with channels, but also with any other processes you may spawn on your own. Like background workers, email sending stuff etc. So yeah, it will not be suitable for everyone, but can be useful in many cases where you do not use channels/other processes.

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews