agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

In a remote server/client setup, quitting client causes the server to crash. #317

Closed farzadbekran closed 2 years ago

farzadbekran commented 2 years ago

What the title says. This combined with dev mode on yesod and #312 really breaks the workflow (having to delete the db files, starting the server again and initializing db on every code change)

agentm commented 2 years ago

Oh, we had a similar bug some years ago, but I thought it was fixed. Do you receive a specific exception? This is probably due to the recent upgrade to the streamly library- it should be easy to fix.

farzadbekran commented 2 years ago

This is all I get: project-m36-server: Network.Socket.recvBuf: end of file (end of file)

agentm commented 2 years ago

I may need some additional details in order to reproduce this locally. Which operating system are you running?

The following steps work for me on Linux locally:

cabal run project-m36-server -- -n spam -d /tmp/db
#in terminal B
cabal run tutd -- -h 127.0.0.1 -n spam
TutorialD (master/main): x:=true
TutorialD (master/main): :commit
#in terminal C
killall -9 tutd
#in terminal B, witness that tutd was killed
cabal run tutd -- -h 127.0.0.1 -n spam
TutorialD (master/main): :showexpr x
┌┐
││
├┤
└┘

There must be some additional detail in your configuration. Are you using notifications perhaps?

farzadbekran commented 2 years ago

I'm using ArchLinux. This is all the steps I take (the directory does not exist, so a fresh db):

first terminal:

stack exec -- project-m36-server -n shopper-db -d shopper-db --fsync

second terminal:

stack exec -- tutd -h 127.0.0.1 -n shopper-db
TutorialD (master/main): :quit
Goodbye.

in the first terminal:

project-m36-server: Network.Socket.recvBuf: end of file (end of file)

my stack.yaml:

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/31.yaml

packages:
- .
extra-deps:
extra-deps:
  - git: https://github.com/agentm/project-m36.git
    commit: 81ff8a6d38973c26ce4a42151dc387fbd89ff7b5
  - git: https://github.com/agentm/curryer.git
    commit: 74ecaac619ad1165a4517d5c0f4e530493bda130
  - git: https://github.com/composewell/streamly.git
    commit: ac3af8749194f1788704dda8667d0b3807075cc2
  - fast-builder-0.1.2.1
  - winery-1.3.2
  - barbies-2.0.2.0
  - barbies-th-0.1.7
  - extended-reals-0.2.3.0
  - data-interval-2.0.1
  - stm-containers-1.1.0.4
  - stm-hamt-1.2.0.4
  - rset-1.0.0
  - hashable-time-0.2.0.2
  - network-transport-tcp-0.7.0
  - megaparsec-7.0.5
  - network-2.8.0.1
  - primitive-extras-0.8
  - primitive-unlifted-0.1.3.0
  - prettyprinter-1.7.0
  - prettyprinter-ansi-terminal-1.1.2
  - base16-bytestring-1.0.1.0
  - modern-uri-0.3.4.0
agentm commented 2 years ago

An old version of the network module in the stack configurations turned out to be the cause of the crash. Fixed now in all stack configurations.