joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.8k stars 383 forks source link

Sharing database DBF files rewrite changes made by other program #2973

Closed ptakgit closed 3 years ago

ptakgit commented 3 years ago

Code of Conduct & Contributing Guidelines

Have you checked that no other similar bug report(s) already exists?

What operating system(s) this bug have occurred on?

WINDOWS 10 PRO 64 bite

What version(s) of DOSBox-X have this bug?

dosbox-x-win64-0.83.17

Describe the bug

Appending from more programs into the sharing database DBF files rewrite changes made by other program. If two programs simultaneously append records, finally only records from one program will be saved. I made a test program. It append 100.000 record into TEST.DBF. If you start it twice, there should be finally 200.000 records. But there is only half - 100.000 record correctresult s AppendTest.zip .

Expected behavior

expected result of two simultaneously instances - 200.000 records. DOSBOX-X get only 100.000 records.

correctresult

Steps to reproduce the behaviour

  1. Unzip AppendTest
  2. Run APPEND.EXE in DOSBOX-X simultaneously in more instances.

Used configuration

[sdl]
fullscreen=false
fulldouble=false
fullresolution=desktop
windowresolution=original
windowposition=
display=0
output=ttf
autolock=false
clip_mouse_button=right
clip_key_modifier=shift
clip_paste_bios=default
clip_paste_speed=30
sensitivity=100
mouse_emulation=integration
mouse_wheel_key=-1
waitonerror=true
priority=higher,normal
mapperfile=DOSBOX.MAP
usescancodes=auto
titlebar=
showbasic=false
showdetails=false
showmenu=false

[dosbox]
title=
fastbioslogo=true
startbanner=false
bannercolortheme=default
dpi aware=auto
quit warning=auto
show advanced options=false
hostkey=mapper
mapper send key=ctrlaltdel
synchronize time=true
machine=svga_s3
captures=capture
autosave=
saveslot=1
savefile=
saveremark=true
forceloadstate=false
memsize=16
nocachedir=true
freesizecap=cap

[video]
vmemsize=-1
vmemsizekb=0
high intensity blinking=true

[pc98]
pc-98 BIOS copyright string=false
pc-98 fm board=auto
pc-98 enable 256-color=true
pc-98 enable 16-color=true
pc-98 enable grcg=true
pc-98 enable egc=true
pc-98 bus mouse=true
pc-98 force ibm keyboard layout=false

[render]
frameskip=0
aspect=false
euro=-1
doublescan=true
scaler=normal2x
glshader=none
pixelshader=none
autofit=true
monochrome_pal=green
ttf.font=
ttf.outputswitch=auto
ttf.winperc=70
ttf.ptsize=0
ttf.lins=43
ttf.cols=132
ttf.wp=
ttf.blinkc=false

[vsync]
vsyncmode=off
vsyncrate=75

[cpu]
core=dynamic
fpu=true
cputype=auto
cycles=auto
cycleup=10
cycledown=20
apmbios=true
isapnpbios=true

[keyboard]
aux=true
controllertype=auto
auxdevice=intellimouse

[voodoo]
voodoo_card=auto
glide=false
splash=true

[mixer]
nosound=false
swapstereo=false
rate=44100
blocksize=1024

[midi]
mpu401=intelligent
mpubase=0
mididevice=default
midiconfig=
samplerate=44100
mpuirq=-1
mt32.romdir=
fluid.driver=default
fluid.soundfont=

[sblaster]
sbtype=sb16
sbbase=220
irq=7
dma=1
hdma=5
enable speaker=false
sbmixer=true
oplmode=auto
oplemu=default
oplrate=44100
oplport=
hardwarebase=220
goldplay=true
blaster environment variable=true

[gus]
gus=false
gusrate=44100
gusmemsize=-1
gus master volume=0.00
gusbase=240
gusirq=5
gusdma=3
gustype=classic
ultradir=C:\ULTRASND

[innova]
innova=false
samplerate=22050
sidbase=280
quality=0

[speaker]
pcspeaker=true
pcrate=44100
tandy=auto
tandyrate=44100
disney=false
ps1audio=off
ps1audiorate=22050

[joystick]
joysticktype=auto
timed=true
autofire=false
swap34=false
buttonwrap=false

[mapper]
joy1deadzone0-=0.60
joy1deadzone0+=0.60
joy1deadzone1-=0.60
joy1deadzone1+=0.60
joy1deadzone2-=0.60
joy1deadzone2+=0.60
joy1deadzone3-=0.60
joy1deadzone3+=0.60
joy1deadzone4-=0.60
joy1deadzone4+=0.60
joy1deadzone5-=0.60
joy1deadzone5+=0.60
joy1deadzone6-=0.60
joy1deadzone6+=0.60
joy1deadzone7-=0.60
joy1deadzone7+=0.60
joy2deadzone0-=0.60
joy2deadzone0+=0.60
joy2deadzone1-=0.60
joy2deadzone1+=0.60
joy2deadzone2-=0.60
joy2deadzone2+=0.60
joy2deadzone3-=0.60
joy2deadzone3+=0.60
joy2deadzone4-=0.60
joy2deadzone4+=0.60
joy2deadzone5-=0.60
joy2deadzone5+=0.60
joy2deadzone6-=0.60
joy2deadzone6+=0.60
joy2deadzone7-=0.60
joy2deadzone7+=0.60

[serial]
serial1=dummy
serial2=dummy
serial3=disabled
serial4=disabled
serial5=disabled
serial6=disabled
serial7=disabled
serial8=disabled
serial9=disabled
phonebookfile=phonebook-dosbox-x.txt

[parallel]
parallel1=printer
parallel2=disabled
parallel3=disabled
parallel4=disabled
parallel5=disabled
parallel6=disabled
parallel7=disabled
parallel8=disabled
parallel9=disabled
dongle=false

[printer]
printer=true
dpi=360
width=85
height=110
printoutput=printer
multipage=false
device=-
docpath=.
fontpath=FONTS
openwith=
openerror=
shellhide=false
timeout=0

[dos]
xms=true
xms handles=0
shell configuration as commands=false
hma=true
ansi.sys=true
share=true
file access tries=0
network redirector=true
minimum mcb free=0
dosv=off
ems=true
umb=true
quick reboot=false
ver=7.1
lfn=auto
automount=true
automountall=false
mountwarning=false
autofixwarning=true
startcmd=true
startwait=true
startquiet=true
int33=true
keyboardlayout=cz
dos clipboard device enable=false
dos clipboard device name=CLIP$
dos clipboard api=true
hard drive data rate limit=0

[ipx]
ipx=false

[ne2000]
ne2000=false
nicbase=300
nicirq=3
backend=pcap

[ethernet, pcap]
realnic=list

[ethernet, slirp]
ipv4_network=10.0.2.0
ipv4_netmask=255.255.255.0
ipv4_host=10.0.2.2
ipv4_nameserver=10.0.2.3
ipv4_dhcp_start=10.0.2.15

[ide, primary]
enable=true
pnp=true

[ide, secondary]
enable=true
pnp=true

[ide, tertiary]
enable=false
pnp=true

[ide, quaternary]
enable=false
pnp=true

[ide, quinternary]
enable=false
pnp=true

[ide, sexternary]
enable=false
pnp=true

[ide, septernary]
enable=false
pnp=true

[ide, octernary]
enable=false
pnp=true

[fdc, primary]
enable=false
pnp=true
mode=ps2

[4dos]
rem=This section is the 4DOS.INI file, if you use 4DOS as the command shell

[config]
rem=This section is DOS's CONFIG.SYS file, not all CONFIG.SYS options supported
break=off
numlock=on
shell=
dos=high, umb
fcbs=100
files=200
rem country=42,852 -- nefunguje
country=42,852
lastdrive=a
set path=Z:\
set prompt=$P$G
set temp=
install=
installhigh=
device=
devicehigh=

Emulator log

No response

Additional context

No response

emendelson commented 3 years ago

Have you tried to do the same experiment with vDos?

emendelson commented 3 years ago

@ptakgit - I forgot to flag your name in the previous message, so here's an alert for you...

ptakgit commented 3 years ago

Hi Emendelson,

with the VDOS program works correctly - the screenshots above come from VDOS . The problem is the cashing of files in the DOSBOX-X.

Daniel

emendelson commented 3 years ago

@ptakgit - Thank you for reporting your results.

emendelson commented 3 years ago

@ptakgit - Wengier Wu has written to me to ask me to post this response (I have no way of testing this; I am merely repeating what Wengier asked me to post):

It is recommended to set the config option "file access tries" to "3" in [dos] section of dosbox-x.conf in order to use the exact same code (and get the exact same result) in DOSBox-X and vDos/Plus. In fact, this is a good demonstration showing the difference between the setting "file access tries=0" and "file access tries=3" in the configuration. If I set it to 0, then I will get 100000 for the test program as reported, but if I set it to 3, then I will get 200000 just like in vDos/Plus.

ptakgit commented 3 years ago

Thank you for the suggested option. But I have serious doubts as to whether this solution is the right one. Why the value of the option "file access tries" set to exactly "3"? Because it started working on a particular PC and situation? What if, for example, due to windows load, another instance of the database program slows down and even the third attempt is not enough and data is lost. In addition, in a way that none of the applications will detect. Imagine an accounting application that losing data this way?

emendelson commented 3 years ago

@ptakgit - I don't know the answer. I only repeated what @Wengier asked me to write. I hope he will visit the forum himself to respond to your questions. I believe Wengier is one of the authors of the relevant code, and he will surely know the answer.

Wengier commented 3 years ago

@ptakgit So @emendelson asked me to answer your question directly here. As mentioned above, the setting "file access tries=3" simply tries to replicate the exact behavior of vDos/Plus in DOSBox-X for file locking. By setting "file access tries=3", DOSBox-X does exactly what vDos/Plus does for file/record locking, but in DOSBox-X it is more flexible since you can choose a different value for the setting "file access tries" and compare the result, or simply disable the access tries with the value "0" in DOSBox-X. Note that the value "3" is chosen and hardcoded in vDos/Plus because it has appeared to be a good choice for file locking purpose. By setting this value you simply get the exact same behavior for networking database operations in both DOSBox-X and vDos/Plus. Hope this helps.

ptakgit commented 3 years ago

Thank you for the explanation. Any value greater than zero worked correctly on my computer. Perhaps this setting should be set to "file access tries = 3" by default, because otherwise there is a risk of losing or damaging consistency when running simultaneously from several PCs on the same data.

Wengier commented 3 years ago

The option file access tries = 3 is already the default for new Windows installations as suggested. Thanks for the confirmation that the said setting works as expected, and the test program mentioned in the post is a very good confirmation for the effectiveness of the file/record-locking functions in DOSBox-X.