Rappi

Rappi

Hello Community!

I’m writing my bachelor’s thesis on visualizing distributed protocols using Elixir, and I’ve run into the problem that the built-in Kino render_seq_trace function doesn’t display the messages in their actual order. Does anyone know how to fix this? I only learned Elixir two months ago and need a practical solution quickly.

Help would be great :slight_smile:

Showing Posts 1 to 5

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

Hey there :waving_hand:

It’s been a while since I wrote the original version of the trace function, but if I recall correctly it should be sorting messages by their monotonic timestamp (kino/lib/kino/process.ex at 7fe0aae1329d90015e8d76aed46daeaa65b76c2f · livebook-dev/kino · GitHub). Do you have a reproducible issue where messages are being rendered out of order?

Rappi

Rappi OP

defmodule Test do
  def func() do
    receive do
      {:message, pid} ->
        send(pid, {:back, self()})
        receive do
          {:back, _pid} -> :ok
        end
    end
  end
  
  
  def execute() do
    p1 = spawn(fn -> func() end)
    p2 = spawn(fn -> func() end)
    send(p1, {:message, p2})
    send(p2, {:message, p1})
    receive do
      _ -> :ok
    after
      100 -> :timeout
    end
  end
end

Kino.Process.render_seq_trace(fn -> Test.execute() end)

I know the receive in the end is not doing anything but without the :back messages are not being displayed at all. That’s another weird phenomenon. Every time I run this code I get a different order in the diagram.

I can’t upload images but e.g. the messages are shown before the SPAWN.

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

Thanks for sending that snippet over. I’m currently away from my machine…but I can possibly play around with this in the next couple of days!

Rappi

Rappi OP

Thank you very much!

I also have a related question: Is it intended that, for GenServers, the server responses generated by call are not displayed in seq_trace?

Rappi

Rappi OP

Update: If you use strict monotonic timestamp instead it works fine

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews