简体   繁体   中英

Unix.error 31 write when using Functory module

I am using the functory module and I am facing a very bizarre issue with the code.

My code is working fine and I have been able to parallelized a play on my game but when I try to play once again (launch another time a parallelized function) it raises a really weird error.

Here you can find the error :

Fatal error: exception Unix.Unix_error(43, "write", "")
Raised by primitive operation at file "unix.ml", line 252, characters 7-34
Called from file "protocol.ml", line 45, characters 10-32
Re-raised at file "network.ml", line 536, characters 10-11
Called from file "network.ml", line 565, characters 47-80
Called from file "list.ml", line 73, characters 12-15
Called from file "network.ml", line 731, characters 4-27
Called from file "map_fold.ml", line 98, characters 4-242
Called from file "game_ia.ml", line 111, characters 10-54
Called from file "gameplay.ml", line 34, characters 12-48
Called from file "gameplay.ml", line 57, characters 22-37
Called from file "gameplay.ml", line 85, characters 5-22

So I've decided to search in the following folders to see what primitive operation has been raised :

(unix.ml) external rename : string -> string -> unit = "unix_rename"
(network.ml) Some jid when w.state <> Disconnected -> send w (Protocol.Master.Kill jid)

So for some reason, it seems that my worker disconnects by itself. I was wondering if any of you already had this issue and what to do in order to solve it ?

You can find my game here . The main files involved are game_ia.ml (best_move_parallelized) and gameplay.ml (at the very bottom).

Thank you in advance for your help.

The error you get is (type the following in the toploop)¹:

# (Obj.magic 43: Unix.error);;
- : Unix.error = Unix.EPROTOTYPE

which means: Protocol wrong type for socket . So you have to examine how you initialize your socket.

¹ You can also count the exceptions in unix.mli , knowing that the first one, E2BIG , is 0 . Emacs Cu 43 ↓ helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM